Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add production stage to Dockerfile #4053

Merged
merged 4 commits into from
Mar 24, 2020
Merged

Add production stage to Dockerfile #4053

merged 4 commits into from
Mar 24, 2020

Conversation

phuongdh
Copy link
Member

No description provided.

@phuongdh phuongdh changed the title [WIP] Add production stage to Dockerfile Add production stage to Dockerfile Mar 18, 2020
@phuongdh phuongdh force-pushed the multi-stage-prod branch 2 times, most recently from 6d6af90 to a3cf926 Compare March 18, 2020 21:02
@phuongdh phuongdh marked this pull request as ready for review March 23, 2020 13:31
&& curl -L https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz | tar xvz -C /usr/bin/ \
&& mkdir -p /tmp/ffmpeg && cd /tmp/ffmpeg \
&& chmod +x /usr/local/bin/chromedriver
RUN curl https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /chrome.deb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this installed later or only downloaded?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nvm...I see it now.

Dockerfile Outdated
# Dev stage for building dev image
FROM ruby:2.5.5-slim-stretch as dev
# Base stage for building final images
FROM ruby:2.5.5-slim-stretch as base
ENV BUNDLER_VERSION 2.0.2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True

Comment on lines +67 to +70
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@cjcolvar cjcolvar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I only had a couple questions.
What impact does splitting some of the multi-line RUN commands into their own lines have? I thought you had collapsed them before to cut down on the number of layers.

@phuongdh
Copy link
Member Author

This looks good to me. I only had a couple questions.
What impact does splitting some of the multi-line RUN commands into their own lines have? I thought you had collapsed them before to cut down on the number of layers.

Cutting down on layers only matters in the final image. For the supporting stages, I sometimes split them up to get granular caching (1 voided cache doesn't ruin others)

Copy link
Member

@cjcolvar cjcolvar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Squash merge or are the separate commits helpful?

@phuongdh phuongdh merged commit df55d76 into develop Mar 24, 2020
@joncameron joncameron mentioned this pull request Jun 9, 2020
22 tasks
phuongdh added a commit that referenced this pull request Jun 9, 2020
* Restructure Dockerfile, add prod stage

* Add build target to docker-compose

* Further slim down prod image

* Allow logging to stdout in production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants