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
|
context: ./apps/api
|
||||||
push: true
|
push: true
|
||||||
tags: frankchine/geocrop-api:latest, frankchine/geocrop-api:${{ github.sha }}
|
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
|
# Build stage
|
||||||
FROM node:20-alpine as build
|
FROM node:20-alpine AS build
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
@ -9,5 +9,8 @@ RUN npm run build
|
||||||
# Production stage
|
# Production stage
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
COPY --from=build /app/dist /usr/share/nginx/html
|
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
|
EXPOSE 80
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
|
|
|
||||||
|
|
@ -15,34 +15,10 @@ spec:
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: web
|
- name: web
|
||||||
image: nginx:alpine
|
image: frankchine/geocrop-web:latest
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 80
|
- containerPort: 80
|
||||||
volumeMounts:
|
imagePullPolicy: Always
|
||||||
- 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
|
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue