-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6270 from alphagov/sengi/dockerfile
Dockerfile cleanup + enable bootsnap.
- Loading branch information
Showing
5 changed files
with
30 additions
and
18 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
.dockerignore | ||
.git | ||
.github | ||
.gitignore | ||
Dockerfile | ||
Jenkinsfile | ||
Procfile | ||
README.md | ||
app.json | ||
coverage | ||
docs | ||
features | ||
log | ||
node_modules | ||
package.json | ||
script | ||
spec | ||
startup.sh | ||
test | ||
tmp | ||
yarn.lock |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,26 @@ | ||
ARG base_image=ghcr.io/alphagov/govuk-ruby-base:3.1.2 | ||
ARG builder_image=ghcr.io/alphagov/govuk-ruby-builder:3.1.2 | ||
ARG ruby_version=3.1.2 | ||
ARG base_image=ghcr.io/alphagov/govuk-ruby-base:$ruby_version | ||
ARG builder_image=ghcr.io/alphagov/govuk-ruby-builder:$ruby_version | ||
|
||
FROM $builder_image AS builder | ||
|
||
ENV BUNDLE_WITHOUT="development test webkit" | ||
FROM $builder_image AS builder | ||
|
||
RUN mkdir -p /app && ln -fs /tmp /app/tmp && ln -fs /tmp /home/app | ||
WORKDIR /app | ||
COPY Gemfile Gemfile.lock .ruby-version /app/ | ||
WORKDIR $APP_HOME | ||
COPY Gemfile* .ruby-version ./ | ||
RUN bundle install | ||
COPY . /app | ||
RUN bundle exec rails assets:precompile && rm -fr /app/log | ||
COPY . . | ||
RUN bootsnap precompile --gemfile . | ||
RUN rails assets:precompile && rm -fr log | ||
|
||
|
||
FROM $base_image | ||
|
||
ENV GOVUK_APP_NAME=smartanswers | ||
ENV GOVUK_APP_NAME=smart-answers | ||
|
||
RUN mkdir -p /app && ln -fs /tmp /app/tmp && ln -fs /tmp /home/app | ||
WORKDIR /app | ||
|
||
COPY --from=builder /usr/bin/node* /usr/bin/ | ||
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/ | ||
COPY --from=builder /app ./ | ||
WORKDIR $APP_HOME | ||
COPY --from=builder $BUNDLE_PATH $BUNDLE_PATH | ||
COPY --from=builder $BOOTSNAP_CACHE_DIR $BOOTSNAP_CACHE_DIR | ||
COPY --from=builder $APP_HOME . | ||
|
||
USER app | ||
|
||
CMD ["bundle", "exec", "puma"] | ||
CMD ["puma"] |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) | ||
|
||
require "bundler/setup" # Set up gems listed in the Gemfile. | ||
require "bootsnap/setup" |