Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
VenkataChalla554 committed May 31, 2024
1 parent d7ee30a commit a053f63
Showing 1 changed file with 8 additions and 24 deletions.
32 changes: 8 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,25 @@ ENV APP_HOME /app
RUN mkdir $APP_HOME
WORKDIR $APP_HOME

# Set timezone
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

# Install runtime dependencies
RUN apk add --update --no-cache libpq yarn yaml-dev

# Copy Gemfile and Gemfile.lock before bundle install
COPY .tool-versions Gemfile Gemfile.lock ./

# Install gems with verbose logging
RUN bundle install --without=test development --jobs=4 --verbose

# Clean up bundler cache
RUN rm -rf /usr/local/bundle/cache

# Remove build dependencies
RUN apk del .build-deps
RUN apk add --update --no-cache --virtual build-dependances \
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-dependances

# Copy package.json and yarn.lock and install yarn packages
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile && \
yarn cache clean
RUN yarn install --frozen-lockfile && \
yarn cache clean

# Copy application code
COPY . .

# Set environment variables
RUN echo export PATH=/usr/local/bin:\$PATH > /root/.ashrc
ENV ENV="/root/.ashrc"

Expand All @@ -49,12 +35,10 @@ 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

0 comments on commit a053f63

Please sign in to comment.