-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
41 lines (27 loc) · 1.01 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
FROM ruby:3.4.1-alpine
LABEL maintainer="Klaus Meyer <[email protected]>"
ARG SOURCE_COMMIT
ENV SOURCE_COMMIT=$SOURCE_COMMIT
ENV PORT=8080
ENV RAILS_ENV=production
ENV RAILS_SERVE_STATIC_FILES=true
ENV RAILS_LOG_TO_STDOUT=true
EXPOSE $PORT
ENTRYPOINT ["/docker-entrypoint.sh"]
RUN apk update \
&& apk add build-base zlib-dev tzdata git openssl-dev shared-mime-info postgresql-dev libc6-compat vips-dev \
&& rm -rf /var/cache/apk/* \
&& mkdir -p /var/www/rails
COPY Gemfile Gemfile.lock /var/www/rails/
COPY docker-entrypoint.sh /docker-entrypoint.sh
WORKDIR /var/www/rails/
RUN gem install bundler -v $(grep -A1 "BUNDLED WITH" Gemfile.lock | tail -n1 | tr -d "[:space:]") \
&& bundle config set without "development test" \
&& bundle install
ADD . /var/www/rails/
RUN SECRET_KEY_BASE=dummyvalue bundle exec rails assets:precompile
RUN addgroup -S rails && adduser -S rails -G rails -h /var/www/rails/ \
&& chown -R rails:rails /var/www/rails/ \
&& chown -R rails:rails /usr/local/bundle
USER rails
CMD ["web"]