tacticalrmm/docker/containers/tactical-frontend/dockerfile

41 lines
969 B
Plaintext

FROM node:16-alpine AS builder
WORKDIR /home/node/app
COPY ./web/package.json .
RUN npm install -g npm@latest
RUN npm install
COPY ./web .
# copy env file to set DOCKER_BUILD to true
RUN echo "DOCKER_BUILD=1" > .env
# 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
RUN npm run build
FROM nginxinc/nginx-unprivileged:stable-alpine
ENV PUBLIC_DIR /usr/share/nginx/html
USER root
RUN deluser --remove-home nginx \
&& addgroup -S nginx -g 1000 \
&& adduser -S -G nginx -u 1000 nginx
RUN apk add --no-cache bash
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
COPY --from=builder /home/node/app/dist/ ${PUBLIC_DIR}
RUN chown -R nginx:nginx /etc/nginx && chown -R nginx:nginx ${PUBLIC_DIR}
COPY docker/containers/tactical-frontend/entrypoint.sh /docker-entrypoint.d/
RUN chmod +x /docker-entrypoint.d/entrypoint.sh
USER nginx
EXPOSE 8080