Created
September 6, 2018 09:02
-
-
Save gottfrois/55693dbd2cfdcdd4bf6987939c235198 to your computer and use it in GitHub Desktop.
medium-multi-stage-dockerfile-release-stage
This file contains hidden or 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 release | |
FROM runner as release | |
LABEL description="Builds a release image removing unneeded files and dependencies" | |
# Removes development and test gems by re-running the bundle | |
# install command using cached gems and simply removing unneeded | |
# gems using the clean option. | |
RUN bundle install --local --clean --without development test \ | |
# Remove unneeded cached gems | |
&& find vendor/bundle/ -name "*.gem" -delete \ | |
# Remove unneeded files and folders | |
&& rm -rf spec tmp/cache node_modules app/assets vendor/assets lib/assets | |
# Copy compiled assets | |
COPY --chown=app:app --from=compiler /home/app/public /home/app/public | |
ARG ASSET_HOST | |
ARG ENV=production | |
# Set App env variables | |
ENV ASSET_HOST $ASSET_HOST | |
ENV RAILS_ENV $ENV |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment