File tree Expand file tree Collapse file tree 7 files changed +185
-2
lines changed
Expand file tree Collapse file tree 7 files changed +185
-2
lines changed Original file line number Diff line number Diff line change 99 - " .github/workflows/docker.yml"
1010
1111jobs :
12- build :
12+ build-website :
1313 runs-on : ubuntu-latest
1414 steps :
1515 - name : Checkout repository
3535 tags : fraguinha/a50passos.com:latest
3636 context : ./src/website
3737 file : ./src/website/Dockerfile
38+
39+ build-assets :
40+ runs-on : ubuntu-latest
41+ steps :
42+ - name : Checkout repository
43+ uses : actions/checkout@v4
44+
45+ - name : Set up QEMU
46+ uses : docker/setup-qemu-action@v3
47+
48+ - name : Set up Docker Buildx
49+ uses : docker/setup-buildx-action@v3
50+
51+ - name : Log in to Docker Hub
52+ uses : docker/login-action@v3
53+ with :
54+ username : ${{ secrets.DOCKER_USERNAME }}
55+ password : ${{ secrets.DOCKER_PASSWORD }}
56+
57+ - name : Build and push Docker image
58+ uses : docker/build-push-action@v5
59+ with :
60+ push : true
61+ platforms : linux/amd64,linux/arm/v7
62+ tags : fraguinha/a50passos-assets:latest
63+ context : .
64+ file : ./src/website/Dockerfile.assets
Original file line number Diff line number Diff line change 1+ apiVersion : networking.k8s.io/v1
2+ kind : Ingress
3+ metadata :
4+ name : a50passos-ingress
5+ namespace : a50passos
6+ annotations :
7+ cert-manager.io/cluster-issuer : letsencrypt
8+ kubernetes.io/ingress.class : traefik
9+ spec :
10+ rules :
11+ - host : a50passos.com
12+ http :
13+ paths :
14+ - backend :
15+ service :
16+ name : website
17+ port :
18+ number : 8080
19+ path : /
20+ pathType : Prefix
21+ - host : www.a50passos.com
22+ http :
23+ paths :
24+ - backend :
25+ service :
26+ name : website
27+ port :
28+ number : 8080
29+ path : /
30+ pathType : Prefix
31+ - host : a50passos.pt
32+ http :
33+ paths :
34+ - backend :
35+ service :
36+ name : website
37+ port :
38+ number : 8080
39+ path : /
40+ pathType : Prefix
41+ - host : www.a50passos.pt
42+ http :
43+ paths :
44+ - backend :
45+ service :
46+ name : website
47+ port :
48+ number : 8080
49+ path : /
50+ pathType : Prefix
51+ tls :
52+ - hosts :
53+ - a50passos.com
54+ - www.a50passos.com
55+ - a50passos.pt
56+ - www.a50passos.pt
57+ secretName : a50passos-tls-secret
Original file line number Diff line number Diff line change 1+ apiVersion : kustomize.config.k8s.io/v1beta1
2+ kind : Kustomization
3+ namespace : a50passos
4+ resources :
5+ - namespace.yml
6+ - website.yml
7+ - ingress.yml
Original file line number Diff line number Diff line change 1+ apiVersion : v1
2+ kind : Namespace
3+ metadata :
4+ name : a50passos
Original file line number Diff line number Diff line change 1+ apiVersion : apps/v1
2+ kind : Deployment
3+ metadata :
4+ name : website
5+ namespace : a50passos
6+ spec :
7+ replicas : 2
8+ selector :
9+ matchLabels :
10+ app : website
11+ template :
12+ metadata :
13+ labels :
14+ app : website
15+ spec :
16+ initContainers :
17+ - name : create-uploads-dir
18+ image : busybox
19+ command : ['sh', '-c', 'mkdir -p /app/dist/public/images/uploads && chmod -R 755 /app/dist/public/images/uploads']
20+ volumeMounts :
21+ - name : images
22+ mountPath : /app/dist/public/images
23+ - name : copy-image-assets
24+ image : fraguinha/a50passos-assets:latest
25+ imagePullPolicy : Always
26+ command : ['sh', '-c', 'cp -r /assets/* /app/dist/public/images/']
27+ volumeMounts :
28+ - name : images
29+ mountPath : /app/dist/public/images
30+ containers :
31+ - name : website
32+ image : fraguinha/a50passos.com:latest
33+ imagePullPolicy : Always
34+ ports :
35+ - containerPort : 8080
36+ env :
37+ - name : PORT
38+ value : " 8080"
39+ - name : NODE_ENV
40+ value : " production"
41+ - name : APPNAME
42+ value : " a50passos"
43+ - name : DATABASE
44+ valueFrom :
45+ secretKeyRef :
46+ name : a50passos-secrets
47+ key : DATABASE
48+ - name : SESSION_SECRET
49+ valueFrom :
50+ secretKeyRef :
51+ name : a50passos-secrets
52+ key : SESSION_SECRET
53+ volumeMounts :
54+ - name : images
55+ mountPath : /app/dist/public/images
56+ volumes :
57+ - name : images
58+ persistentVolumeClaim :
59+ claimName : a50passos-images-pvc
60+ ---
61+ apiVersion : v1
62+ kind : Service
63+ metadata :
64+ name : website
65+ namespace : a50passos
66+ spec :
67+ selector :
68+ app : website
69+ ports :
70+ - port : 8080
71+ targetPort : 8080
72+ ---
73+ apiVersion : v1
74+ kind : PersistentVolumeClaim
75+ metadata :
76+ name : a50passos-images-pvc
77+ namespace : a50passos
78+ spec :
79+ accessModes :
80+ - ReadWriteMany
81+ storageClassName : longhorn
82+ resources :
83+ requests :
84+ storage : 1Gi
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ RUN npm ci --verbose
1010COPY . .
1111
1212RUN npm run deploy
13+ RUN rm -rf /app/dist/public/images
1314
1415FROM node:22-slim
1516
@@ -19,4 +20,4 @@ COPY --from=builder /app/dist ./dist
1920COPY --from=builder /app/node_modules ./node_modules
2021COPY --from=builder /app/package.json .
2122
22- CMD ["npm" , "start" ]
23+ CMD ["npm" , "start" ]
Original file line number Diff line number Diff line change 1+ FROM busybox
2+
3+ COPY src/website/src/public/images /assets
You can’t perform that action at this time.
0 commit comments