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