2021-03-26 06:32:24 +00:00
|
|
|
FROM node:14-alpine AS builder
|
2020-11-16 19:28:10 +00:00
|
|
|
|
|
|
|
WORKDIR /home/node/app
|
|
|
|
|
|
|
|
COPY ./web/package.json .
|
2021-04-03 21:50:18 +00:00
|
|
|
RUN npm install -g npm@latest
|
2020-11-16 19:28:10 +00:00
|
|
|
RUN npm install
|
2020-11-17 02:22:28 +00:00
|
|
|
|
2020-11-16 19:28:10 +00:00
|
|
|
COPY ./web .
|
2020-11-17 02:22:28 +00:00
|
|
|
|
2020-11-22 17:03:40 +00:00
|
|
|
# copy env file to set DOCKER_BUILD to true
|
2020-11-24 14:33:34 +00:00
|
|
|
RUN echo "DOCKER_BUILD=1" > .env
|
2020-11-22 17:03:40 +00:00
|
|
|
|
2020-11-17 02:22:28 +00:00
|
|
|
# modify index.html template to allow injection of js variables at runtime
|
|
|
|
RUN sed -i '/<\/head>/i <script src="\/env-config.js"><\/script>' src/index.template.html
|
2020-11-16 19:28:10 +00:00
|
|
|
RUN npm run build
|
|
|
|
|
2022-01-16 03:12:04 +00:00
|
|
|
FROM nginxinc/nginx-unprivileged:stable-alpine
|
2020-11-16 19:28:10 +00:00
|
|
|
|
2020-11-17 02:22:28 +00:00
|
|
|
ENV PUBLIC_DIR /usr/share/nginx/html
|
|
|
|
|
2022-01-16 03:12:04 +00:00
|
|
|
USER root
|
|
|
|
|
2020-11-24 14:33:34 +00:00
|
|
|
RUN apk add --no-cache bash
|
2020-11-29 04:26:53 +00:00
|
|
|
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
|
2020-11-24 14:33:34 +00:00
|
|
|
|
2020-11-17 02:22:28 +00:00
|
|
|
COPY --from=builder /home/node/app/dist/ ${PUBLIC_DIR}
|
|
|
|
|
2020-11-19 03:42:45 +00:00
|
|
|
COPY docker/containers/tactical-frontend/entrypoint.sh /docker-entrypoint.d/
|
|
|
|
RUN chmod +x /docker-entrypoint.d/entrypoint.sh
|
2020-11-20 00:03:44 +00:00
|
|
|
|
2022-01-16 03:12:04 +00:00
|
|
|
RUN chown -R nginx:nginx /usr/share/nginx/html
|
|
|
|
|
|
|
|
USER nginx
|
|
|
|
|
|
|
|
EXPOSE 8080
|