-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
44 lines (33 loc) · 1.19 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM ruby:3.2.2-alpine3.18 AS rb
RUN apk update && apk add --no-cache postgresql-dev build-base libffi-dev nodejs rsync tzdata yarn
COPY Gemfile* package.json yarn.lock ./
RUN yarn install
RUN gem update --system && gem install bundler
RUN bundle config frozen true \
&& bundle config jobs 4 \
&& bundle config deployment true \
&& bundle config without 'development test' \
&& bundle install
ENV RAILS_ENV=production \
SECRET_KEY_BASE=buildingassets
ADD . .
RUN bundle exec rails assets:clobber && bundle exec rails assets:precompile
FROM ruby:3.2.2-alpine3.18
RUN apk update && apk add --no-cache postgresql-client rsync tzdata
WORKDIR /synchronist
RUN gem update --system && gem install bundler
RUN bundle config frozen true \
&& bundle config jobs 4 \
&& bundle config deployment true \
&& bundle config without 'development test'
ADD . .
COPY --from=rb vendor/bundle vendor/bundle
COPY --from=rb public/assets public/assets
COPY docker-entrypoint.sh /bin/
ENV RAILS_ENV=production \
RAILS_SERVE_STATIC_FILES=true \
RAILS_LOG_TO_STDOUT=true
VOLUME /synchronist/storage
ENTRYPOINT ["docker-entrypoint.sh"]
EXPOSE 3000
CMD ["rails", "server", "--binding", "0.0.0.0"]