Skip to content

Commit

Permalink
Try to fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
chrztoph committed Nov 29, 2023
1 parent 33f7edf commit 53d8c8c
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
FROM ruby:2.7.1-alpine AS production

EXPOSE 3000
FROM ruby:2.7.1-alpine AS builder

ARG RAILS_ENV_ARG=production
ARG NODE_ENV_ARG=production
Expand All @@ -12,23 +10,19 @@ ENV RAILS_ROOT /var/www/texterify
RUN mkdir -p $RAILS_ROOT
WORKDIR $RAILS_ROOT

# Install essential libraries.
RUN apk update \
&& apk upgrade \
&& apk add --update --no-cache $BUILD_PACKAGES $RUN_PACKAGES

# Install node.
RUN apk add --repository http://dl-cdn.alpinelinux.org/alpine/v3.14/main nodejs yarn

# Install gems.
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock
RUN gem install bundler:2.1.4
RUN gem install nokogiri
RUN bundle config --global frozen 1 \
&& bundle install --without development test --jobs 20 --retry 5

# Copy project files.
COPY . .

ARG COMMIT_HASH
Expand Down Expand Up @@ -60,7 +54,29 @@ RUN SECRET_KEY_BASE=`bin/rails secret` \

CMD ["rails", "server"]

FROM production AS testing
FROM builder AS production

ARG RAILS_ENV_ARG=production
ARG NODE_ENV_ARG=production
ARG BUILD_PACKAGES="build-base curl-dev git"
ARG RUN_PACKAGES="tzdata postgresql-dev yaml-dev zlib-dev"

ENV RAILS_ENV=$RAILS_ENV_ARG
ENV RAILS_ROOT /var/www/texterify
RUN mkdir -p $RAILS_ROOT
WORKDIR $RAILS_ROOT

RUN apk update \
&& apk upgrade \
&& apk add --update --no-cache $RUN_PACKAGES

COPY --from=builder $RAILS_ROOT $RAILS_ROOT

EXPOSE 3000

CMD ["rails", "server"]

FROM builder AS testing

RUN bundle install --with test
RUN gem install mailcatcher
Expand Down

0 comments on commit 53d8c8c

Please sign in to comment.