forked from codeforjapan/decidim-cfj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
67 lines (52 loc) · 1.7 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
58
59
60
61
62
63
64
65
66
67
FROM node:10.23.0-alpine as node
FROM ruby:2.7.4-alpine
RUN apk update \
&& apk add --no-cache --virtual build-dependencies \
build-base \
curl-dev \
git \
&& apk add --no-cache \
imagemagick \
postgresql-dev \
tzdata \
zip \
&& cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
ENV YARN_VERSION=v1.22.5
# node install
COPY --from=node /usr/local/bin/node /usr/local/bin/node
COPY --from=node /usr/local/include/node /usr/local/include/node
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node /opt/yarn-${YARN_VERSION} /opt/yarn
RUN ln -s /usr/local/bin/node /usr/local/bin/nodejs \
&& ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn
ARG RAILS_ENV="production"
ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
BUNDLER_JOBS=4 \
BUNDLER_VERSION=1.17.3 \
APP_HOME=/app \
RAILS_ENV=${RAILS_ENV} \
RAILS_LOG_TO_STDOUT=true \
RAILS_SERVE_STATIC_FILES=true \
SECRET_KEY_BASE=placeholder
WORKDIR $APP_HOME
COPY Gemfile Gemfile.lock ./
COPY . $APP_HOME
# bundle install
RUN gem install bundler:${BUNDLER_VERSION} \
&& bundle config --global jobs ${BUNDLER_JOBS} \
&& if [ "${RAILS_ENV}" = "production" ];then \
bundle install --without development test \
&& apk del --purge build-dependencies \
;else \
bundle install \
;fi
RUN cp ./entrypoint /usr/bin/entrypoint \
&& chmod +x /usr/bin/entrypoint \
&& chmod -R +x ./bin/
RUN ./bin/rails assets:precompile \
&& yarn cache clean
ENTRYPOINT ["entrypoint"]
EXPOSE 3000
CMD ["./bin/rails", "s", "-b", "0.0.0.0"]