diff --git a/front/Dockerfile b/front/Dockerfile index e6f63154..856e2bec 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -4,6 +4,7 @@ WORKDIR /usr/src COPY messages . RUN yarn install && yarn ts-proto + # webpack build FROM node:14.18.2-buster-slim@sha256:20bedf0c09de887379e59a41c04284974f5fb529cf0e13aab613473ce298da3d as builder 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 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 ARG DEBUG_MODE ARG JITSI_URL @@ -35,33 +45,28 @@ ARG DISABLE_NOTIFICATIONS ARG SKIP_RENDER_OPTIMIZATIONS ARG OPID_LOGIN_SCREEN_PROVIDER -# Removing the iframe.html file from the final image as this adds a XSS attack. -# iframe.html is only in dev mode to circumvent a limitation -RUN rm dist/iframe.html -ENV NODE_ENV=production -RUN ./templater.sh -RUN yarn run typesafe-i18n -RUN \ - DEBUG_MODE=$DEBUG_MODE \ - JITSI_URL=$JITSI_URL \ - JITSI_PRIVATE_MODE=$JITSI_PRIVATE_MODE \ - PUSHER_URL=$PUSHER_URL \ - ICON_URL=$ICON_URL \ - ADMIN_URL=$ADMIN_URL \ - STUN_SERVER=$STUN_SERVER \ - TURN_SERVER=$TURN_SERVER \ - TURN_USER=$TURN_USER \ - TURN_PASSWORD=$TURN_PASSWORD \ - MAX_PER_GROUP=$MAX_PER_GROUP \ - MAX_USERNAME_LENGTH=$MAX_USERNAME_LENGTH \ - 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 +ENV DEBUG_MODE=$DEBUG_MODE +ENV JITSI_URL=$JITSI_URL +ENV JITSI_PRIVATE_MODE=$JITSI_PRIVATE_MODE +ENV PUSHER_URL=$PUSHER_URL +ENV ICON_URL=$ICON_URL +ENV ADMIN_URL=$ADMIN_URL +ENV STUN_SERVER=$STUN_SERVER +ENV TURN_SERVER=$TURN_SERVER +ENV TURN_USER=$TURN_USER +ENV TURN_PASSWORD=$TURN_PASSWORD +ENV MAX_PER_GROUP=$MAX_PER_GROUP +ENV MAX_USERNAME_LENGTH=$MAX_USERNAME_LENGTH +ENV PROFILE_URL=$PROFILE_URL +ENV START_ROOM_URL=$START_ROOM_URL +ENV DISABLE_NOTIFICATIONS=$DISABLE_NOTIFICATIONS +ENV SKIP_RENDER_OPTIMIZATIONS=$SKIP_RENDER_OPTIMIZATIONS +ENV OPID_LOGIN_SCREEN_PROVIDER=$OPID_LOGIN_SCREEN_PROVIDER + +RUN envsubst < dist/env-config.template.js > dist/env-config.js # final production image FROM nginx:mainline-alpine COPY front/nginx-vhost.conf /etc/nginx/conf.d/default.conf COPY --from=builder /usr/src/dist /usr/share/nginx/html +RUN cat /usr/share/nginx/html/env-config.js