-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (27 loc) · 960 Bytes
/
ci-cd.yml
File metadata and controls
35 lines (27 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: Build and Push Docker Images
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
# LOGIN TO GHCR
- name: Log in to GHCR
run: echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u "${{ secrets.GHCR_USERNAME }}" --password-stdin
# BUILD FRONTEND IMAGE
- name: Build frontend image
run: |
docker build -t ghcr.io/${{ secrets.GHCR_USERNAME }}/devops-frontend:latest ./frontend
# BUILD BACKEND IMAGE
- name: Build backend image
run: |
docker build -t ghcr.io/${{ secrets.GHCR_USERNAME }}/devops-backend:latest ./backend
# PUSH IMAGES
- name: Push frontend
run: docker push ghcr.io/${{ secrets.GHCR_USERNAME }}/devops-frontend:latest
- name: Push backend
run: docker push ghcr.io/${{ secrets.GHCR_USERNAME }}/devops-backend:latest