-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
84 lines (67 loc) · 2.14 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
########################
### app/rails config ###
########################
FROM public.ecr.aws/ideacrew/polypress:base AS app
LABEL author="IdeaCrew"
# Configure bundler and PATH, install bundler version
ENV LANG=C.UTF-8 \
GEM_HOME=/bundle \
BUNDLE_JOBS=4 \
BUNDLE_RETRY=3
ENV BUNDLE_PATH $GEM_HOME
ENV BUNDLE_APP_CONFIG=$BUNDLE_PATH \
BUNDLE_BIN=$BUNDLE_PATH/bin
ENV PATH $BUNDLE_BIN:$GEM_HOME/gems/bin:$PATH
ARG BUNDLER_VERSION_OVERRIDE
ENV BUNDLER_VERSION=$BUNDLER_VERSION_OVERRIDE
RUN gem update --system && gem install bundler:$BUNDLER_VERSION
# Configure app home directory
ENV HOME /polypress
RUN mkdir -p $HOME
WORKDIR $HOME
COPY . $HOME
RUN yarn install
# Setting env up
ENV RAILS_ENV='production'
ENV NODE_ENV='production'
ARG SECRET_KEY_BASE
ARG POLYPRESS_DB_HOST
ARG POLYPRESS_DB_PORT
ARG POLYPRESS_DB_NAME
ARG RABBITMQ_URL_EVENT_SOURCE
ARG RABBITMQ_HOST
ARG RABBITMQ_PORT
ARG RABBITMQ_VHOST
ARG MITC_HOST
ARG MITC_PORT
ARG MITC_URL
ENV POLYPRESS_DB_HOST=$POLYPRESS_DB_HOST
ENV POLYPRESS_DB_PORT=$POLYPRESS_DB_PORT
ENV POLYPRESS_DB_NAME=$POLYPRESS_DB_NAME
ENV RABBITMQ_URL_EVENT_SOURCE=$RABBITMQ_URL_EVENT_SOURCE
ENV RABBITMQ_HOST=$RABBITMQ_HOST
ENV RABBITMQ_PORT=$RABBITMQ_PORT
ENV RABBITMQ_VHOST=$RABBITMQ_VHOST
ENV MITC_HOST=$MITC_HOST
ENV MITC_PORT=$MITC_PORT
ENV MITC_URL=$MITC_URL
ENV SECRET_KEY_BASE=$SECRET_KEY_BASE
# Adding gems
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock
RUN bundle install --jobs 20 --retry 5 --without development test
RUN yarn add @rails/webpacker@5.4.0
RUN rails webpacker:install:erb
RUN yarn add bootstrap && yarn add @popperjs/core && yarn add @fortawesome/fontawesome
RUN bundle exec rake assets:precompile
#RUN rm -f /polypress/config/master.key && rm -f /polypress/config/credentials.yml.enc
#CMD ["./entrypoints/docker-entrypoint.sh"]
########################
### web/nginx config ###
########################
FROM nginx:1.17.6-alpine as web
RUN mkdir /polypress
# copy assets from the app build and nginx config
COPY --from=app /polypress/public /polypress/
COPY .docker/production/nginx.conf /etc/nginx/conf.d/polypress.conf
RUN mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf-bkp