-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (47 loc) · 1.9 KB
/
image-to-docker-hub.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
name: Docker Image CI
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
environment: production
steps:
- name: Check Out Repo
uses: actions/checkout@v2
- name: Make envfile
uses: SpicyPizza/create-envfile@v1
with:
envkey_APPLICATION_HOST: ${{ secrets.APPLICATION_HOST }}
envkey_APPLICATION_PORT: ${{ secrets.APPLICATION_PORT }}
envkey_APPLICATION_JWT_SECRET: ${{ secrets.APPLICATION_JWT_SECRET }}
envkey_APPLICATION_DB_HOST: ${{ secrets.APPLICATION_DB_HOST }}
envkey_APPLICATION_DB_USERNAME: ${{ secrets.APPLICATION_DB_USERNAME }}
envkey_APPLICATION_DB_PASSWORD: ${{ secrets.APPLICATION_DB_PASSWORD }}
envkey_APPLICATION_DB_DATABASE: ${{ secrets.APPLICATION_DB_DATABASE }}
envkey_APPLICATION_DB_PORT: ${{ secrets.APPLICATION_DB_PORT }}
envkey_APPLICATION_DB_DIALECT: ${{ secrets.APPLICATION_DB_DIALECT }}
envkey_APPLICATION_REDIS_HOST: ${{ secrets.APPLICATION_REDIS_HOST }}
directory: ./
file_name: .env.production
- id: docker-build
uses: ./.github/actions/docker-build
with:
docker-hub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
docker-hub-access-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
push: 'true'
- name: Image digest
run: echo ${{ steps.docker-build.outputs.docker-build-digest }}
- name: Actualize docker images on VPS
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USERNAME }}
key: ${{ secrets.VPS_SSH_KEY }}
passphrase: ${{ secrets.VPS_SSH_KEY_PASSPHRASE }}
script_stop: true
script: |
cd ${{ secrets.VPS_PROJECT_PATH }}
docker-compose pull
docker-compose down
docker-compose up -d