2020-01-28 13:07:50 -05:00
|
|
|
### STAGE 1: Build ###
|
2020-04-14 22:07:20 -04:00
|
|
|
FROM node AS builder
|
2020-02-01 10:40:34 -05:00
|
|
|
|
2020-01-14 09:35:36 -05:00
|
|
|
RUN mkdir /crc-bpmn
|
|
|
|
WORKDIR /crc-bpmn
|
|
|
|
|
2020-02-01 10:40:34 -05:00
|
|
|
ADD package.json /crc-bpmn/
|
2020-04-14 23:23:11 -04:00
|
|
|
ADD package-lock.json /crc-bpmn/
|
2020-02-01 10:40:34 -05:00
|
|
|
|
|
|
|
COPY . /crc-bpmn/
|
2020-01-28 16:43:38 -05:00
|
|
|
|
2020-05-24 11:42:43 -04:00
|
|
|
ARG build_config=prod
|
2020-02-01 10:40:34 -05:00
|
|
|
RUN npm install && \
|
2020-04-14 17:21:51 -04:00
|
|
|
npm run build:$build_config
|
2020-02-01 10:40:34 -05:00
|
|
|
|
|
|
|
### STAGE 2: Run ###
|
2020-05-20 14:19:33 -04:00
|
|
|
FROM nginx:alpine
|
|
|
|
RUN set -x && apk add --update --no-cache bash libintl gettext curl
|
|
|
|
|
2020-05-25 21:14:47 -04:00
|
|
|
COPY --from=builder /crc-bpmn/dist/* /etc/nginx/html/
|
2020-04-14 23:23:11 -04:00
|
|
|
COPY --from=builder /crc-bpmn/nginx.conf /etc/nginx/conf.d/default.conf
|
2020-05-16 22:18:16 -04:00
|
|
|
|
|
|
|
# Script for substituting environment variables
|
2020-04-14 20:20:08 -04:00
|
|
|
COPY ./docker/substitute-env-variables.sh ./entrypoint.sh
|
2020-04-14 16:22:34 -04:00
|
|
|
RUN chmod +x ./entrypoint.sh
|
2020-05-16 22:18:16 -04:00
|
|
|
|
2020-05-16 22:59:05 -04:00
|
|
|
# Substitute environment variables in nginx configuration and index.html
|
2020-05-26 00:25:02 -04:00
|
|
|
RUN ["./entrypoint.sh", \
|
2020-05-25 21:14:47 -04:00
|
|
|
"/etc/nginx/html/index.html,/etc/nginx/conf.d/default.conf", \
|
2020-05-24 11:26:20 -04:00
|
|
|
"PRODUCTION,API_URL,IRB_URL,HOME_ROUTE,BASE_HREF,PORT0", \
|
2020-05-25 21:14:47 -04:00
|
|
|
"/etc/nginx/html"]
|
2020-02-06 14:45:26 -05:00
|
|
|
|
|
|
|
### STAGE 3: Profit! ###
|
2020-05-26 00:41:54 -04:00
|
|
|
CMD /usr/sbin/nginx -g "daemon off;"
|