diff --git a/back/Dockerfile b/back/Dockerfile index 084ac52a..56a74d39 100644 --- a/back/Dockerfile +++ b/back/Dockerfile @@ -1,5 +1,5 @@ # protobuf build -FROM node:14.18.2-buster-slim@sha256:20bedf0c09de887379e59a41c04284974f5fb529cf0e13aab613473ce298da3d as builder +FROM node:14.18.2-buster-slim@sha256:20bedf0c09de887379e59a41c04284974f5fb529cf0e13aab613473ce298da3d as messages WORKDIR /usr/src COPY messages/yarn.lock messages/package.json ./ RUN yarn install @@ -7,12 +7,12 @@ COPY messages . RUN yarn proto # typescript build -FROM node:14.18.2-buster-slim@sha256:20bedf0c09de887379e59a41c04284974f5fb529cf0e13aab613473ce298da3d as builder2 +FROM node:14.18.2-buster-slim@sha256:20bedf0c09de887379e59a41c04284974f5fb529cf0e13aab613473ce298da3d as builder WORKDIR /usr/src COPY back/yarn.lock back/package.json ./ RUN yarn install COPY back . -COPY --from=builder /usr/src/generated src/Messages/generated +COPY --from=messages /usr/src/generated src/Messages/generated ENV NODE_ENV=production RUN yarn run tsc @@ -22,7 +22,7 @@ WORKDIR /usr/src COPY back/yarn.lock back/package.json ./ ENV NODE_ENV=production RUN yarn install --production -COPY --from=builder2 /usr/src/dist /usr/src/dist +COPY --from=builder /usr/src/dist /usr/src/dist USER node CMD ["yarn", "run", "runprod"] diff --git a/front/Dockerfile b/front/Dockerfile index bc437e64..ec8635e9 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -1,5 +1,5 @@ # protobuf build -FROM node:14.18.2-buster-slim@sha256:20bedf0c09de887379e59a41c04284974f5fb529cf0e13aab613473ce298da3d as builder +FROM node:14.18.2-buster-slim@sha256:20bedf0c09de887379e59a41c04284974f5fb529cf0e13aab613473ce298da3d as messages WORKDIR /usr/src COPY messages/yarn.lock messages/package.json ./ RUN yarn install @@ -7,14 +7,14 @@ COPY messages . RUN yarn ts-proto # typescript build -FROM node:14.18.2-buster-slim@sha256:20bedf0c09de887379e59a41c04284974f5fb529cf0e13aab613473ce298da3d as builder2 +FROM node:14.18.2-buster-slim@sha256:20bedf0c09de887379e59a41c04284974f5fb529cf0e13aab613473ce298da3d as builder WORKDIR /usr/src COPY front/yarn.lock front/package.json ./ RUN yarn install COPY front . -COPY --from=builder /usr/src/ts-proto-generated/protos src/Messages/ts-proto-generated +COPY --from=messages /usr/src/ts-proto-generated/protos src/Messages/ts-proto-generated RUN sed -i 's/import { Observable } from "rxjs";/import type { Observable } from "rxjs";/g' src/Messages/ts-proto-generated/messages.ts -COPY --from=builder /usr/src/JsonMessages src/Messages/JsonMessages +COPY --from=messages /usr/src/JsonMessages src/Messages/JsonMessages RUN yarn run typesafe-i18n && yarn run build-iframe-api && yarn build # final production image @@ -22,7 +22,6 @@ FROM nginx:1.21.6-alpine COPY front/nginx.conf /etc/nginx/conf.d/default.conf COPY front/templater.sh / -COPY --from=builder2 /usr/src/dist /usr/share/nginx/html +COPY --from=builder /usr/src/dist /usr/share/nginx/html -EXPOSE 80 CMD ["/bin/sh", "-c", "/templater.sh && envsubst < /usr/share/nginx/html/env-config.template.js > /usr/share/nginx/html/env-config.js && exec nginx -g 'daemon off;'"] diff --git a/pusher/Dockerfile b/pusher/Dockerfile index 912ef58e..060c4dc2 100644 --- a/pusher/Dockerfile +++ b/pusher/Dockerfile @@ -1,5 +1,5 @@ # protobuf build -FROM node:14.18.2-buster-slim@sha256:20bedf0c09de887379e59a41c04284974f5fb529cf0e13aab613473ce298da3d as builder +FROM node:14.18.2-buster-slim@sha256:20bedf0c09de887379e59a41c04284974f5fb529cf0e13aab613473ce298da3d as messages WORKDIR /usr/src COPY messages/yarn.lock messages/package.json ./ RUN yarn install @@ -7,13 +7,13 @@ COPY messages . RUN yarn proto # typescript build -FROM node:14.18.2-buster-slim@sha256:20bedf0c09de887379e59a41c04284974f5fb529cf0e13aab613473ce298da3d as builder2 +FROM node:14.18.2-buster-slim@sha256:20bedf0c09de887379e59a41c04284974f5fb529cf0e13aab613473ce298da3d as builder WORKDIR /usr/src COPY pusher/yarn.lock pusher/package.json ./ RUN yarn install COPY pusher . -COPY --from=builder /usr/src/generated src/Messages/generated -COPY --from=builder /usr/src/JsonMessages src/Messages/JsonMessages +COPY --from=messages /usr/src/generated src/Messages/generated +COPY --from=messages /usr/src/JsonMessages src/Messages/JsonMessages ENV NODE_ENV=production RUN yarn run tsc @@ -23,7 +23,7 @@ WORKDIR /usr/src COPY pusher/yarn.lock pusher/package.json ./ ENV NODE_ENV=production RUN yarn install --production -COPY --from=builder2 /usr/src/dist /usr/src/dist +COPY --from=builder /usr/src/dist /usr/src/dist USER node CMD ["yarn", "run", "runprod"] diff --git a/uploader/Dockerfile b/uploader/Dockerfile index a9285680..321ef853 100644 --- a/uploader/Dockerfile +++ b/uploader/Dockerfile @@ -1,5 +1,5 @@ # typescript build -FROM node:14.15.4-buster-slim@sha256:cbae886186467bbfd274b82a234a1cdfbbd31201c2a6ee63a6893eefcf3c6e76 as builder2 +FROM node:14.15.4-buster-slim@sha256:cbae886186467bbfd274b82a234a1cdfbbd31201c2a6ee63a6893eefcf3c6e76 as builder WORKDIR /usr/src COPY uploader/yarn.lock uploader/package.json ./ RUN yarn install @@ -13,7 +13,7 @@ WORKDIR /usr/src COPY uploader/yarn.lock uploader/package.json ./ ENV NODE_ENV=production RUN yarn install --production -COPY --from=builder2 /usr/src/dist /usr/src/dist +COPY --from=builder /usr/src/dist /usr/src/dist USER node CMD ["yarn", "run", "runprod"]