|
1 | 1 | # syntax = docker/dockerfile:1
|
2 | 2 |
|
3 | 3 | # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
|
4 |
| -ARG RUBY_VERSION=3.1.2 |
5 |
| -FROM ruby:$RUBY_VERSION-slim as base |
| 4 | +ARG RUBY_VERSION=3.2 |
| 5 | +FROM ruby:$RUBY_VERSION-slim AS base |
6 | 6 |
|
7 | 7 | LABEL fly_launch_runtime="rails"
|
8 | 8 |
|
@@ -30,29 +30,27 @@ RUN apt-get update -qq && \
|
30 | 30 | # rm -rf /tmp/node-build-master
|
31 | 31 |
|
32 | 32 | # Throw-away build stage to reduce size of final image
|
33 |
| -FROM base as build |
| 33 | +FROM base AS build |
34 | 34 |
|
35 | 35 | # Install packages needed to build gems and node modules
|
36 | 36 | RUN apt-get update -qq && \
|
37 |
| - apt-get install --no-install-recommends -y build-essential default-libmysqlclient-dev git libpq-dev libvips node-gyp pkg-config python-is-python3 |
| 37 | + apt-get install --no-install-recommends -y build-essential default-libmysqlclient-dev git libpq-dev libvips libyaml-dev node-gyp pkg-config python-is-python3 |
38 | 38 |
|
39 | 39 | # Build options
|
40 | 40 | ENV PATH="/usr/local/node/bin:$PATH"
|
41 | 41 |
|
42 |
| -# Install application gems |
43 |
| -COPY --link Gemfile ./ |
44 |
| -RUN sed -i "s/, path: '..\/..\/'//" Gemfile |
| 42 | +# Copy application code |
| 43 | +COPY --link . . |
| 44 | + |
| 45 | +# Install application gems. Using Rails 7 for now, as 8 seems to consume more memory. |
| 46 | +RUN sed -i "s/, path: '..\/..\/'//" Gemfile && sed -i "s/'rails', '>= 7.0.0'/'rails', '~> 7.0'/" Gemfile |
45 | 47 | RUN bundle install && \
|
46 | 48 | rm -rf ~/.bundle/ $BUNDLE_PATH/ruby/*/cache $BUNDLE_PATH/ruby/*/bundler/gems/*/.git
|
47 | 49 |
|
48 | 50 | # Install node modules
|
49 | 51 | # COPY --link package.json ./
|
50 | 52 | # RUN npm install
|
51 | 53 |
|
52 |
| -# Copy application code |
53 |
| -COPY --link . . |
54 |
| -RUN sed -i "s/, path: '..\/..\/'//" Gemfile |
55 |
| - |
56 | 54 | # Precompiling assets for production without requiring secret RAILS_MASTER_KEY
|
57 | 55 | RUN sed -i "/link_tree ..\/..\/..\//d" app/assets/config/manifest.js
|
58 | 56 | RUN SECRET_KEY_BASE=DUMMY ./bin/rails assets:precompile
|
|
0 commit comments