update docker for new web build

This commit is contained in:
wh1te909 2022-05-29 07:40:49 +00:00
parent 2508458c80
commit 6a2a2761e1
2 changed files with 13 additions and 19 deletions

View File

@ -1,20 +1,3 @@
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
@ -25,11 +8,20 @@ RUN deluser --remove-home nginx \
&& addgroup -S nginx -g 1000 \
&& adduser -S -G nginx -u 1000 nginx
RUN apk add --no-cache bash
RUN apk add --no-cache bash wget tar grep
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
COPY --from=builder /home/node/app/dist/ ${PUBLIC_DIR}
COPY api/tacticalrmm/tacticalrmm/settings.py /tmp/settings.py
RUN WEB_VERSION=$(grep -o 'WEB_VERSION.*' /tmp/settings.py | cut -d'"' -f 2) \
&& webtar="trmm-web-v${WEB_VERSION}.tar.gz" \
&& wget -q "https://github.com/amidaware/tacticalrmm-web/releases/download/v${WEB_VERSION}/${webtar}" -O /tmp/${webtar} \
&& tar -xzf /tmp/${webtar} -C ${PUBLIC_DIR} \
&& rm -f /tmp/${webtar}
RUN mv ${PUBLIC_DIR}/dist/* ${PUBLIC_DIR}
RUN rm -rf ${PUBLIC_DIR}/dist
RUN chown -R nginx:nginx /etc/nginx && chown -R nginx:nginx ${PUBLIC_DIR}
COPY docker/containers/tactical-frontend/entrypoint.sh /docker-entrypoint.d/

View File

@ -141,6 +141,8 @@ services:
restart: always
networks:
- proxy
volumes:
- tactical_data:/opt/tactical
environment:
API_HOST: ${API_HOST}