From 2ecf22ed2d817ab985fd9f2221f7640a3ccf65d2 Mon Sep 17 00:00:00 2001 From: James Greenhill Date: Mon, 3 Jun 2024 16:49:41 -0700 Subject: [PATCH] build the frontend in CI --- .gitignore | 3 ++- charts/housewatch/templates/nginx-configmap.yaml | 4 ++-- frontend/Dockerfile | 4 +++- frontend/vite.config.ts | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 99416d8..2bbd411 100644 --- a/.gitignore +++ b/.gitignore @@ -167,4 +167,5 @@ housewatch.sqlite3 .DS_Store yarn.lock -charts/housewatch/charts/ \ No newline at end of file +charts/housewatch/charts/ +.pnpm/ \ No newline at end of file diff --git a/charts/housewatch/templates/nginx-configmap.yaml b/charts/housewatch/templates/nginx-configmap.yaml index 450bceb..702f27d 100644 --- a/charts/housewatch/templates/nginx-configmap.yaml +++ b/charts/housewatch/templates/nginx-configmap.yaml @@ -31,7 +31,7 @@ data: } location /admin { - proxy_pass http://housewatch-api:8000; + proxy_pass http://{{ include "housewatch.fullname" . }}-api:8000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; @@ -39,7 +39,7 @@ data: } location /healthz { - proxy_pass http://housewatch-api:8000; + proxy_pass http://{{ include "housewatch.fullname" . }}-api:8000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 1ce372a..f22eae4 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,7 +1,9 @@ -FROM alpine:latest +FROM node:lts-alpine3.20 WORKDIR /frontend +RUN pnpm i && vite build + COPY build/ build/ CMD ["echo", "Serve the files from /frontend/build, don't run this container directly"] \ No newline at end of file diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 201371a..e385b91 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -23,7 +23,7 @@ export default defineConfig({ }, }, }, - base: process.env.NODE_ENV === "production" ? "/webapp/" : "/", + base: "/", build: { outDir: "./build" }