From 34f3d104674b866cc5b5a9e2302ad92fe32d9265 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 11 Jun 2024 10:06:09 -0700 Subject: [PATCH] Move Frontend deploy steps from Dockerfile to app --- frontend/.dockerignore | 3 +-- frontend/Dockerfile | 5 ++--- frontend/package.json | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/frontend/.dockerignore b/frontend/.dockerignore index 8d369a793..bec3f011b 100644 --- a/frontend/.dockerignore +++ b/frontend/.dockerignore @@ -1,7 +1,5 @@ *.md LICENSE -.idea -.vscode coverage cypress dist @@ -10,3 +8,4 @@ e2e migrations output tests +Dockerfile diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 0b60e0ebf..ea444bb54 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -5,14 +5,13 @@ FROM node:20.14.0-bullseye-slim AS build # See .dockerignore for exclusions WORKDIR /app COPY . ./ -RUN npm ci --ignore-scripts --no-update-notifier --omit=dev && \ - npm run build +RUN npm run deploy # Deploy using Caddy to host static files FROM caddy:2.8.4-alpine RUN apk add --no-cache ca-certificates -# Copy static files and run formatting +# Copy static files, verify Caddyfile formatting COPY --from=build /app/dist /srv COPY Caddyfile /etc/caddy/Caddyfile RUN caddy fmt /etc/caddy/Caddyfile diff --git a/frontend/package.json b/frontend/package.json index 1b5489ddd..af8dd7078 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -8,6 +8,7 @@ "clean": "rimraf ./node_modules/.vite", "build:analyze": "vite build --mode analyze", "build:clean": "rimraf dist", + "deploy": "npm ci --ignore-scripts --no-update-notifier --omit=dev && npm run build", "preview": "vite preview", "test:unit": "vitest --mode test", "test:cov": "vitest run --mode test --coverage",