-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (67 loc) · 2.23 KB
/
strapi.yml
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
on:
push:
branches:
- main
paths:
- ".github/workflows/strapi.yml"
- ".github/scripts/auth.sh"
- ".github/scripts/deploy.sh"
- "backend/**/*"
name: Cloud Game Backend Strapi
jobs:
build-backend:
name: Build Strapi API
runs-on: ubuntu-latest
env:
IMAGE: cloudgame/backend-api
steps:
- uses: actions/checkout@master
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Docker Container
run: |
docker build -t $IMAGE:$GITHUB_RUN_ID -f backend/Dockerfile-prod-be --build-arg DD_GIT_REPOSITORY_URL=$(git config --get remote.origin.url) --build-arg DD_GIT_COMMIT_SHA=${{ github.sha }} .
- name: Push Container
run: |
docker tag $IMAGE:$GITHUB_RUN_ID $IMAGE:latest
docker push $IMAGE:$GITHUB_RUN_ID
docker push $IMAGE:latest
build-frontend:
name: Build Strapi Frontend
runs-on: ubuntu-latest
env:
IMAGE: cloudgame/backend-admin
steps:
- uses: actions/checkout@master
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Docker Container
run: |
cd backend
docker build -t $IMAGE:$GITHUB_RUN_ID -f Dockerfile-prod-fe --build-arg ADMIN_URL=${ADMIN_URL} --build-arg SERVER_URL=${SERVER_URL} --build-arg DD_GIT_REPOSITORY_URL=$(git config --get remote.origin.url) --build-arg DD_GIT_COMMIT_SHA=${{ github.sha }} .
env:
ADMIN_URL: /
SERVER_URL: https://api.cloud-game.app/
- name: Push Container
run: |
docker tag $IMAGE:$GITHUB_RUN_ID $IMAGE:latest
docker push $IMAGE:$GITHUB_RUN_ID
docker push $IMAGE:latest
deploy:
name: Deploy
runs-on: ubuntu-latest
needs:
- build-backend
- build-frontend
steps:
- uses: actions/checkout@master
- name: Deploy to Server
env:
DEPLOY_SSH_PRIV_KEY: ${{ secrets.DEPLOY_SSH_PRIV_KEY }}
run: ./.github/scripts/deploy.sh