2020-01-28 13:07:50 -05:00
|
|
|
### STAGE 1: Build ###
|
2021-03-15 17:17:16 -04:00
|
|
|
FROM quay.io/sartography/node:latest AS builder
|
2021-01-11 18:29:31 -05:00
|
|
|
RUN mkdir /app
|
|
|
|
WORKDIR /app
|
|
|
|
ADD package.json /app/
|
|
|
|
ADD package-lock.json /app/
|
2020-06-16 11:09:17 -04:00
|
|
|
COPY . /app/
|
2021-01-11 18:58:18 -05:00
|
|
|
ARG build_config=prod
|
|
|
|
RUN npm install && \
|
|
|
|
npm run build:$build_config
|
|
|
|
|
2021-03-16 10:44:24 -04:00
|
|
|
|
2020-02-01 10:40:34 -05:00
|
|
|
### STAGE 2: Run ###
|
2021-03-15 17:17:16 -04:00
|
|
|
FROM quay.io/sartography/nginx:alpine
|
2021-04-16 14:24:38 -04:00
|
|
|
RUN set -x && apk add --update --no-cache bash libintl gettext curl``
|
2020-05-20 14:19:33 -04:00
|
|
|
|
2020-06-16 11:09:17 -04:00
|
|
|
COPY --from=builder /app/dist/* /etc/nginx/html/
|
|
|
|
COPY --from=builder /app/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-26 14:48:31 -04:00
|
|
|
# Fix for Angular routing
|
|
|
|
RUN echo "pushstate: enabled" > /etc/nginx/html/Staticfile
|
|
|
|
|
2020-05-26 08:28:42 -04:00
|
|
|
# The entrypoint.sh script will run after the container finishes starting.
|
|
|
|
# Substitutes environment variables in nginx configuration and index.html,
|
2020-05-26 09:02:37 -04:00
|
|
|
# then starts/reloads nginx.
|
2020-05-26 01:51:21 -04:00
|
|
|
ENTRYPOINT ["./entrypoint.sh", \
|
2020-05-25 21:14:47 -04:00
|
|
|
"/etc/nginx/html/index.html,/etc/nginx/conf.d/default.conf", \
|
2020-06-12 16:34:21 -04:00
|
|
|
"PRODUCTION,API_URL,IRB_URL,HOME_ROUTE,BASE_HREF,DEPLOY_URL,PORT0,GOOGLE_ANALYTICS_KEY,SENTRY_KEY,TITLE", \
|
2020-05-26 08:28:42 -04:00
|
|
|
"/etc/nginx/html", \
|
|
|
|
"true"]
|