-
Notifications
You must be signed in to change notification settings - Fork 32
/
Dockerfile
57 lines (43 loc) · 1.22 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
45
46
47
48
49
50
51
52
53
54
55
56
57
# build stage
FROM ruby:2.7.2-alpine AS builder
ARG build_without
ARG rails_env="development"
ARG to_remove
ENV SECRET_KEY_BASE=dumb
ENV EXECJS_RUNTIME=Node
RUN apk add --update --no-cache \
openssl \
tar \
build-base \
tzdata \
postgresql-dev \
postgresql-client \
nodejs \
&& wget https://yarnpkg.com/latest.tar.gz \
&& mkdir -p /opt/yarn \
&& tar -xf latest.tar.gz -C /opt/yarn --strip 1 \
&& mkdir -p /var/app
ENV PATH="$PATH:/opt/yarn/bin" BUNDLE_JOBS=4 RAILS_ENV=${rails_env} BUNDLE_WITHOUT=${bundle_without}
COPY . /var/app
WORKDIR /var/app
RUN bundle install && yarn && bundle exec rake assets:precompile \
&& rm -rf /usr/local/bundle/cache/*.gem \
&& find /usr/local/bundle/gems/ -name "*.c" -delete \
&& find /usr/local/bundle/gems/ -name "*.o" -delete \
&& rm -rf $to_remove
# final stage
FROM ruby:2.7.2-alpine
LABEL maintainer="[email protected]"
ARG extra_packages
RUN apk add --update --no-cache \
openssl \
tzdata \
postgresql-dev \
postgresql-client \
$extra_packages
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
COPY --from=builder /var/app /var/app
ENV RAILS_LOG_TO_STDOUT true
WORKDIR /var/app
EXPOSE 3000
CMD bin/rails s -b 0.0.0.0