Switch tactical-frontend to nginx-unprivileged container

This commit is contained in:
Joel DeTeves 2022-01-15 19:12:04 -08:00
parent faac572c30
commit 707e67918b
2 changed files with 9 additions and 6 deletions

View File

@ -15,10 +15,12 @@ RUN echo "DOCKER_BUILD=1" > .env
RUN sed -i '/<\/head>/i <script src="\/env-config.js"><\/script>' src/index.template.html RUN sed -i '/<\/head>/i <script src="\/env-config.js"><\/script>' src/index.template.html
RUN npm run build RUN npm run build
FROM nginx:stable-alpine FROM nginxinc/nginx-unprivileged:stable-alpine
ENV PUBLIC_DIR /usr/share/nginx/html ENV PUBLIC_DIR /usr/share/nginx/html
USER root
RUN apk add --no-cache bash RUN apk add --no-cache bash
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"] SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
@ -27,4 +29,8 @@ COPY --from=builder /home/node/app/dist/ ${PUBLIC_DIR}
COPY docker/containers/tactical-frontend/entrypoint.sh /docker-entrypoint.d/ COPY docker/containers/tactical-frontend/entrypoint.sh /docker-entrypoint.d/
RUN chmod +x /docker-entrypoint.d/entrypoint.sh RUN chmod +x /docker-entrypoint.d/entrypoint.sh
EXPOSE 80 RUN chown -R nginx:nginx /usr/share/nginx/html
USER nginx
EXPOSE 8080

View File

@ -12,7 +12,7 @@ echo "window._env_ = {PROD_URL: \"https://${API_HOST}\"}" >> ${PUBLIC_DIR}/env-c
nginx_config="$(cat << EOF nginx_config="$(cat << EOF
server { server {
listen 80; listen 8080;
charset utf-8; charset utf-8;
location / { location / {
@ -21,9 +21,6 @@ server {
add_header Cache-Control "no-store, no-cache, must-revalidate"; add_header Cache-Control "no-store, no-cache, must-revalidate";
add_header Pragma "no-cache"; add_header Pragma "no-cache";
} }
error_log /var/log/nginx/app-error.log;
access_log /var/log/nginx/app-access.log;
} }
EOF EOF
)" )"