tacticalrmm/docker/containers/tactical-frontend/dockerfile

30 lines
686 B
Plaintext
Raw Normal View History

2020-11-16 19:28:10 +00:00
FROM node:12-alpine AS builder
WORKDIR /home/node/app
COPY ./web/package.json .
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
2020-11-24 14:33:34 +00:00
FROM nginx: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
2020-11-24 14:33:34 +00:00
RUN apk add --no-cache bash
SHELL ["/bin/bash", "-c"]
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
EXPOSE 80