From ec39ad82a9257c3aae11ef60c0c81a1362b73ead Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Sat, 30 Jul 2022 12:20:42 +0200 Subject: fix(web/ui): Fix Docker deployment This change fixes the Docker deployment of the OpenDC web UI. There have been several updates to the build process of the web UI, which have not taken into account the Docker deployment process. This change addresses these discrepancies. --- opendc-web/opendc-web-ui/Dockerfile | 12 ++++++------ opendc-web/opendc-web-ui/scripts/envsubst.sh | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'opendc-web') diff --git a/opendc-web/opendc-web-ui/Dockerfile b/opendc-web/opendc-web-ui/Dockerfile index 15a92068..5ff85092 100644 --- a/opendc-web/opendc-web-ui/Dockerfile +++ b/opendc-web/opendc-web-ui/Dockerfile @@ -2,8 +2,8 @@ FROM node:16 AS staging MAINTAINER OpenDC Maintainers # Copy package details -COPY ./package.json ./yarn.lock /opendc/ -RUN cd /opendc && yarn install --frozen-lockfile +COPY ./package.json ./package-lock.json /opendc/ +RUN cd /opendc && npm ci # Build frontend FROM node:16 AS build @@ -17,12 +17,12 @@ RUN cd /opendc/ \ NEXT_PUBLIC_AUTH0_DOMAIN="%%NEXT_PUBLIC_AUTH0_DOMAIN%%" \ NEXT_PUBLIC_AUTH0_CLIENT_ID="%%NEXT_PUBLIC_AUTH0_CLIENT_ID%%" \ NEXT_PUBLIC_AUTH0_AUDIENCE="%%NEXT_PUBLIC_AUTH0_AUDIENCE%%" \ - && yarn build \ - && yarn cache clean --all \ - && mv .next .next.template + && npm run build \ + && npm cache clean --force \ + && mv build/next build/next.template FROM node:16-slim COPY --from=build /opendc /opendc WORKDIR /opendc -CMD ./scripts/envsubst.sh; yarn start +CMD ./scripts/envsubst.sh; npm run start diff --git a/opendc-web/opendc-web-ui/scripts/envsubst.sh b/opendc-web/opendc-web-ui/scripts/envsubst.sh index d7ae9ecb..afc976ed 100755 --- a/opendc-web/opendc-web-ui/scripts/envsubst.sh +++ b/opendc-web/opendc-web-ui/scripts/envsubst.sh @@ -3,8 +3,8 @@ set -e auto_envsubst() { - input_path="/opendc/.next.template" - output_path="/opendc/.next" + input_path="build/next.template" + output_path="build/next" cp -r "$input_path" "$output_path" find "$output_path" -type f -name '*.js' -exec perl -pi -e 's/%%(NEXT_PUBLIC_[_A-Z0-9]+)%%/$ENV{$1}/g' {} \; -- cgit v1.2.3