Last active
December 21, 2021 12:07
-
-
Save TsubasaKawajiri/511151ebfe1b8a5bbe3dcaf22b74c133 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:[RUBY_VERSION]-alpine[ALPINE_VERSION] AS builder | |
RUN apk update && \ | |
apk add --no-cache tzdata curl-dev g++ make git nodejs yarn mariadb-dev[if MYSQL] | |
WORKDIR /builder | |
COPY . /builder | |
COPY ./Gemfile ./Gemfile.lock ./package.json ./yarn.lock ./ | |
RUN gem install bundler && \ | |
bundle config set without 'development test' && \ | |
bundle config set no-cache 'true' && \ | |
bundle install -j8 && \ | |
find /usr/local/bundle -path 'gems/*/ext/*/Makefile' -exec dirname {} \; | xargs -n1 -P$(nproc) -I{} make -C {} clean && \ | |
rm -rf /usr/local/bundle/cache | |
RUN rails assets:precompile RAILS_ENV=[RAILS_ENV] SECRET_KEY_BASE=[SECRET_KEY_BASE] | |
FROM ruby:[RUBY_VERSION]-alpine[ALPINE_VERSION] AS application | |
RUN apk update --no-cache && \ | |
apk add --no-cache tzdata mariadb-dev[if MYSQL] | |
WORKDIR /app | |
COPY . /app | |
COPY --from=builder /builder/public /app/public | |
COPY --from=builder /usr/local/bundle /usr/local/bundle | |
ENV LANG=C.UTF-8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment