Created
September 6, 2018 09:00
-
-
Save gottfrois/2797b52c1f154706dc06ffbf7ddd96dd to your computer and use it in GitHub Desktop.
medium-multi-stage-dockerfile-compiler-stage
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
############################### | |
# Stage compiler | |
FROM runner as compiler | |
LABEL description="Builds a compiler image used to compile assets" | |
# Copy cached compiled assets to avoid re-compiling them | |
# We use latest compiler image to get already compiled assets | |
# and save lots of time on assets compilation for this new image | |
COPY --chown=app:app --from=my-app:compiler /home/app/public /home/app/public | |
COPY --chown=app:app --from=my-app:compiler /home/app/tmp /home/app/tmp | |
# Env variables required to run rake assets:precompile | |
ARG ASSET_HOST | |
ARG ENV=production | |
# Precompile assets and keep the cache for future releases | |
RUN ASSET_HOST=$ASSET_HOST \ | |
RAILS_ENV=$ENV \ | |
bundle exec rake assets:precompile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment