fix dockerfile

This commit is contained in:
_Bastler
2022-02-20 13:28:10 +01:00
parent 136269170d
commit f7167537c3
+30 -25
View File
@@ -4,6 +4,7 @@ WORKDIR /usr/src
COPY messages . COPY messages .
RUN yarn install && yarn ts-proto RUN yarn install && yarn ts-proto
# webpack build # webpack build
FROM node:14.18.2-buster-slim@sha256:20bedf0c09de887379e59a41c04284974f5fb529cf0e13aab613473ce298da3d as builder FROM node:14.18.2-buster-slim@sha256:20bedf0c09de887379e59a41c04284974f5fb529cf0e13aab613473ce298da3d as builder
WORKDIR /usr/src WORKDIR /usr/src
@@ -16,6 +17,15 @@ COPY --from=messages /usr/src/ts-proto-generated/protos src/Messages/ts-proto-ge
RUN sed -i 's/import { Observable } from "rxjs";/import type { Observable } from "rxjs";/g' src/Messages/ts-proto-generated/messages.ts RUN sed -i 's/import { Observable } from "rxjs";/import type { Observable } from "rxjs";/g' src/Messages/ts-proto-generated/messages.ts
COPY --from=messages /usr/src/JsonMessages src/Messages/JsonMessages COPY --from=messages /usr/src/JsonMessages src/Messages/JsonMessages
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& apt-get install -y \
gettext-base
RUN rm dist/iframe.html
RUN yarn run typesafe-i18n
RUN yarn run build
RUN ./templater.sh
# passing arguments as environment # passing arguments as environment
ARG DEBUG_MODE ARG DEBUG_MODE
ARG JITSI_URL ARG JITSI_URL
@@ -35,33 +45,28 @@ ARG DISABLE_NOTIFICATIONS
ARG SKIP_RENDER_OPTIMIZATIONS ARG SKIP_RENDER_OPTIMIZATIONS
ARG OPID_LOGIN_SCREEN_PROVIDER ARG OPID_LOGIN_SCREEN_PROVIDER
# Removing the iframe.html file from the final image as this adds a XSS attack. ENV DEBUG_MODE=$DEBUG_MODE
# iframe.html is only in dev mode to circumvent a limitation ENV JITSI_URL=$JITSI_URL
RUN rm dist/iframe.html ENV JITSI_PRIVATE_MODE=$JITSI_PRIVATE_MODE
ENV NODE_ENV=production ENV PUSHER_URL=$PUSHER_URL
RUN ./templater.sh ENV ICON_URL=$ICON_URL
RUN yarn run typesafe-i18n ENV ADMIN_URL=$ADMIN_URL
RUN \ ENV STUN_SERVER=$STUN_SERVER
DEBUG_MODE=$DEBUG_MODE \ ENV TURN_SERVER=$TURN_SERVER
JITSI_URL=$JITSI_URL \ ENV TURN_USER=$TURN_USER
JITSI_PRIVATE_MODE=$JITSI_PRIVATE_MODE \ ENV TURN_PASSWORD=$TURN_PASSWORD
PUSHER_URL=$PUSHER_URL \ ENV MAX_PER_GROUP=$MAX_PER_GROUP
ICON_URL=$ICON_URL \ ENV MAX_USERNAME_LENGTH=$MAX_USERNAME_LENGTH
ADMIN_URL=$ADMIN_URL \ ENV PROFILE_URL=$PROFILE_URL
STUN_SERVER=$STUN_SERVER \ ENV START_ROOM_URL=$START_ROOM_URL
TURN_SERVER=$TURN_SERVER \ ENV DISABLE_NOTIFICATIONS=$DISABLE_NOTIFICATIONS
TURN_USER=$TURN_USER \ ENV SKIP_RENDER_OPTIMIZATIONS=$SKIP_RENDER_OPTIMIZATIONS
TURN_PASSWORD=$TURN_PASSWORD \ ENV OPID_LOGIN_SCREEN_PROVIDER=$OPID_LOGIN_SCREEN_PROVIDER
MAX_PER_GROUP=$MAX_PER_GROUP \
MAX_USERNAME_LENGTH=$MAX_USERNAME_LENGTH \ RUN envsubst < dist/env-config.template.js > dist/env-config.js
PROFILE_URL=$PROFILE_URL \
START_ROOM_URL=$START_ROOM_URL \
DISABLE_NOTIFICATIONS=$DISABLE_NOTIFICATIONS \
SKIP_RENDER_OPTIMIZATIONS=$SKIP_RENDER_OPTIMIZATIONS \
OPID_LOGIN_SCREEN_PROVIDER=$OPID_LOGIN_SCREEN_PROVIDER \
yarn run build
# final production image # final production image
FROM nginx:mainline-alpine FROM nginx:mainline-alpine
COPY front/nginx-vhost.conf /etc/nginx/conf.d/default.conf COPY front/nginx-vhost.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /usr/src/dist /usr/share/nginx/html COPY --from=builder /usr/src/dist /usr/share/nginx/html
RUN cat /usr/share/nginx/html/env-config.js