From b69cd682d26e650d4a53d66d0db84725f0c7e612 Mon Sep 17 00:00:00 2001 From: Venkata Challa Date: Fri, 31 May 2024 13:19:02 +0100 Subject: [PATCH] wip --- Dockerfile | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index aaad2cff..f9e76c58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,18 +8,27 @@ RUN apk add --update --no-cache tzdata && \ cp /usr/share/zoneinfo/Europe/London /etc/localtime && \ echo "Europe/London" > /etc/timezone +# Install build dependencies +RUN apk add --update --no-cache --virtual .build-deps \ + postgresql-dev build-base \ + && apk add --update --no-cache libpq yarn yaml-dev + +# Copy Gemfile and Gemfile.lock before bundle install COPY .tool-versions Gemfile Gemfile.lock ./ -RUN apk add --update --no-cache --virtual .build-deps \ - postgresql-dev build-base && \ - apk add --update --no-cache libpq yarn yaml-dev && \ - bundle install --without=test development --jobs=4 && \ - rm -rf /usr/local/bundle/cache && \ - apk del .build-deps +# Install gems +RUN bundle install --without=test development --jobs=4 + +# Clean up bundler cache +RUN rm -rf /usr/local/bundle/cache + +# Remove build dependencies +RUN apk del .build-deps +# Copy package.json and yarn.lock and install yarn packages COPY package.json yarn.lock ./ RUN yarn install --frozen-lockfile && \ - yarn cache clean + yarn cache clean COPY . . @@ -35,10 +44,12 @@ ENV GOVUK_NOTIFY_API_KEY=$GOVUK_NOTIFY_API_KEY ARG GOVUK_NOTIFY_GENERIC_EMAIL_TEMPLATE_ID ENV GOVUK_NOTIFY_GENERIC_EMAIL_TEMPLATE_ID=$GOVUK_NOTIFY_GENERIC_EMAIL_TEMPLATE_ID +# Precompile assets and clean up RUN RAILS_ENV=production \ SECRET_KEY_BASE=required_but_does_not_matter_for_assets \ bundle exec rake assets:precompile && \ rm -rf node_modules tmp && \ apk del yarn nodejs +# Set the default command CMD ./bin/app-startup.sh