-
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (45 loc) · 1.89 KB
/
prod.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
name: prod
on:
workflow_dispatch
jobs:
deploy:
environment:
name: prod
name: Build and deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Config
env:
ENV_VALUES: ${{ secrets.ENV_VALUES }}
shell: bash
run: 'echo "$ENV_VALUES" > api/.env'
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.REGISTRY_ACTOR }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push image to GitHub Container Registry
run: |
docker-compose -f docker-compose.yml -f docker-compose.prod.yml build --no-cache php
docker tag back-end_php:latest ${{ secrets.REGISTRY_DOCKER_REGISTRY }}/cobalt-php:latest
docker push ${{ secrets.REGISTRY_DOCKER_REGISTRY }}/cobalt-php:latest
docker-compose -f docker-compose.yml -f docker-compose.prod.yml build --no-cache caddy
docker tag back-end_caddy:latest ${{ secrets.REGISTRY_DOCKER_REGISTRY }}/cobalt-caddy:latest
docker push ${{ secrets.REGISTRY_DOCKER_REGISTRY }}/cobalt-caddy:latest
- name: Deploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
cd /root/app
docker login --username ${{ secrets.REGISTRY_ACTOR }} --password ${{ secrets.REGISTRY_TOKEN }} ghcr.io
docker image pull ${{ secrets.REGISTRY_DOCKER_REGISTRY }}/cobalt-php:latest
docker image pull ${{ secrets.REGISTRY_DOCKER_REGISTRY }}/cobalt-caddy:latest
docker compose up --no-build --pull never --detach cobaltphp
docker compose up --no-build --pull never --detach cobaltcaddy