From 943990dc42d44fbea9b6d0141d24f5ab0f0cdb37 Mon Sep 17 00:00:00 2001 From: Daniil Isakov <12859907+oplexz@users.noreply.github.com> Date: Fri, 12 Jan 2024 16:26:26 +0300 Subject: [PATCH] Dockerfile: Automatically build static files for Web UI --- Dockerfile | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 985b03e7..969d2711 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,15 +3,24 @@ FROM docker.io/library/node:18-alpine AS build_node_modules -# Copy Web UI -COPY src/ /app/ -WORKDIR /app +# Copy Web UI source and build static files +COPY webui/ /webui/ +WORKDIR /webui +RUN npm ci +RUN npm run build + +# Copy server, install requirements +COPY src/ /server/ +WORKDIR /server RUN npm ci --omit=dev # Copy build result to a new image. # This saves a lot of disk space. FROM docker.io/library/node:18-alpine -COPY --from=build_node_modules /app /app + +# Copy the server files and the built static files +COPY --from=build_node_modules /server /app +COPY --from=build_node_modules /webui/dist /app/www # Move node_modules one directory up, so during development # we don't have to mount it in a volume.