-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (45 loc) · 1.56 KB
/
deploy-app.yaml
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
36
37
38
39
40
41
42
43
44
45
46
name: Deploy app
on:
push:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
# This step checks out a copy of your repository.
- name: check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Login to docker hub
run: echo "${{secrets.DOCKER_PASSWORD}}" | docker login -u ${{secrets.DOCKER_USERNAME}} --password-stdin
- name: Build, tag and Push Images
run: |
REPO=${{secrets.DOCKER_USERNAME}}/macrobimadoption
TAG=latest
docker build --no-cache -t $REPO:frontend-$TAG --build-arg NEXT_PUBLIC_APP_DOMAIN=${{secrets.NEXT_PUBLIC_APP_DOMAIN}} ./frontend
docker build --no-cache -t $REPO:backend-$TAG --build-arg POSTGRES_PRISMA_URL=${{secrets.POSTGRES_PRISMA_URL}} ./backend
docker build --no-cache -t $REPO:nginx-$TAG ./proxy
docker push $REPO:frontend-$TAG
docker push $REPO:backend-$TAG
docker push $REPO:nginx-$TAG
deploy:
needs: build
name: Deploy
runs-on: self-hosted
steps:
- name: Checkout compose.yaml file
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Create .env file for runtime (deploy)
run: |
echo "POSTGRES_PRISMA_URL=${{secrets.POSTGRES_PRISMA_URL}}" > ./backend/.env
- name: Stop existing containers and remove images
run: docker-compose down --rmi all
- name: Run container with Docker Compose
run: docker-compose up -d