From b1c6a9b2905ce24ff74b376b507c76f5897097fb Mon Sep 17 00:00:00 2001 From: fchinembiri Date: Tue, 28 Apr 2026 13:20:53 +0200 Subject: [PATCH] fix: containerize web app and update CI/CD to build web image --- .gitea/workflows/build-push.yaml | 7 +++++++ apps/web/Dockerfile | 5 ++++- k8s/base/40-web.yaml | 28 ++-------------------------- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/.gitea/workflows/build-push.yaml b/.gitea/workflows/build-push.yaml index c0e23d5..6d36aeb 100644 --- a/.gitea/workflows/build-push.yaml +++ b/.gitea/workflows/build-push.yaml @@ -35,3 +35,10 @@ jobs: context: ./apps/api push: true tags: frankchine/geocrop-api:latest, frankchine/geocrop-api:${{ github.sha }} + + - name: Build and push Web Image + uses: docker/build-push-action@v4 + with: + context: ./apps/web + push: true + tags: frankchine/geocrop-web:latest, frankchine/geocrop-web:${{ github.sha }} diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index e51b424..bdf1910 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -1,5 +1,5 @@ # Build stage -FROM node:20-alpine as build +FROM node:20-alpine AS build WORKDIR /app COPY package*.json ./ RUN npm install @@ -9,5 +9,8 @@ RUN npm run build # Production stage FROM nginx:alpine COPY --from=build /app/dist /usr/share/nginx/html +# If there is a profile.jpg or other assets in public folder they will be copied to dist +# If not, we should ensure they are handled. + EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] diff --git a/k8s/base/40-web.yaml b/k8s/base/40-web.yaml index f94a251..9814bb2 100644 --- a/k8s/base/40-web.yaml +++ b/k8s/base/40-web.yaml @@ -15,34 +15,10 @@ spec: spec: containers: - name: web - image: nginx:alpine + image: frankchine/geocrop-web:latest ports: - containerPort: 80 - volumeMounts: - - name: html - mountPath: /usr/share/nginx/html/index.html - subPath: index.html - - name: assets - mountPath: /usr/share/nginx/html/assets - - name: profile - mountPath: /usr/share/nginx/html/profile.jpg - subPath: profile.jpg - - name: favicon - mountPath: /usr/share/nginx/html/favicon.jpg - subPath: favicon.jpg - volumes: - - name: html - configMap: - name: geocrop-web-html - - name: assets - configMap: - name: geocrop-web-assets - - name: profile - configMap: - name: geocrop-web-profile - - name: favicon - configMap: - name: geocrop-web-favicon + imagePullPolicy: Always --- apiVersion: v1 kind: Service