fix: containerize web app and update CI/CD to build web image
This commit is contained in:
parent
03483140c3
commit
b1c6a9b290
|
|
@ -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 }}
|
||||
|
|
|
|||
|
|
@ -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;"]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue