-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (42 loc) · 1.36 KB
/
build-deploy-docker.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
name: build-deploy-docker
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
GITLAB_REGISTRY_USERNAME: ${{ secrets.GITLAB_REGISTRY_USERNAME }}
GITLAB_REGISTRY_TOKEN: ${{ secrets.GITLAB_REGISTRY_TOKEN }}
jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- name: Check out repo.
uses: actions/checkout@v4
- name: Copy docker compose file to OCI.
uses: appleboy/[email protected]
with:
host: ${{ secrets.ORACLE_HOST }}
username: ${{ secrets.ORACLE_USERNAME }}
key: ${{ secrets.ORACLE_SSH_KEY }}
source: "./"
target: "./SegmentationService"
- name: Pull docker and deploy.
uses: appleboy/[email protected]
with:
host: ${{ secrets.ORACLE_HOST }}
username: ${{ secrets.ORACLE_USERNAME }}
key: ${{ secrets.ORACLE_SSH_KEY }}
script_stop: true
envs: GITLAB_REGISTRY_USERNAME, GITLAB_REGISTRY_TOKEN
script: |
echo "$GITLAB_REGISTRY_TOKEN" | docker login registry.gitlab.com -u "$GITLAB_REGISTRY_USERNAME" --password-stdin
cd SegmentationService
sudo docker compose build
sudo docker compose push
sudo docker compose up --detach
sudo docker system prune --force
cd ..
rm -rf SegmentationService