Skip to content

Commit f2cd359

Browse files
committed
fix(cicd): build image on runner and to Docker Hub
1 parent 05b1a4c commit f2cd359

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

.github/workflows/deploy.yml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,11 @@ jobs:
1313
environment: production
1414

1515
steps:
16-
- name: Setup Docker context
17-
uses: arwynfr/actions-docker-context@v2
16+
- name: Login to Docker Hub
17+
uses: docker/login-action@v3
1818
with:
19-
docker_host: ssh://${{ vars.REMOTE_USER }}@${{ secrets.REMOTE_HOST }}
20-
context_name: prod-remote-context
21-
ssh_key: ${{ secrets.SSH_PRIVATE_KEY }}
22-
use_context: true
23-
24-
- name: Set up SSH key
25-
run: |
26-
mkdir -p ~/.ssh
27-
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
28-
chmod 600 ~/.ssh/id_ed25519
29-
ssh-keyscan -H ${{ secrets.REMOTE_HOST }} >> ~/.ssh/known_hosts
19+
username: ${{ vars.DOCKERHUB_USERNAME }}
20+
password: ${{ secrets.DOCKERHUB_TOKEN }}
3021

3122
- name: Build Docker image(s)
3223
uses: docker/bake-action@v6
@@ -36,15 +27,26 @@ jobs:
3627
files: |
3728
docker-bake.hcl
3829
docker-bake.prod.hcl
39-
push: false
30+
push: true
4031
no-cache: true
4132

4233
- name: Checkout repository
4334
uses: actions/checkout@v3
4435

45-
- name: Get Docker context information
36+
- name: Setup Docker context
37+
uses: arwynfr/actions-docker-context@v2
38+
with:
39+
docker_host: ssh://${{ vars.REMOTE_USER }}@${{ secrets.REMOTE_HOST }}
40+
context_name: prod-remote-context
41+
ssh_key: ${{ secrets.SSH_PRIVATE_KEY }}
42+
use_context: true
43+
44+
- name: Set up SSH key
4645
run: |
47-
docker context ls
46+
mkdir -p ~/.ssh
47+
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
48+
chmod 600 ~/.ssh/id_ed25519
49+
ssh-keyscan -H ${{ secrets.REMOTE_HOST }} >> ~/.ssh/known_hosts
4850
4951
- name: Deploy stack
5052
uses: hoverkraft-tech/compose-action@v2

compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
biixie_frontend:
33
image: biixie.com:frontend-latest
4-
pull_policy: if_not_present
4+
pull_policy: always
55
container_name: biixie_frontend
66
ports:
77
- "8080:80"
@@ -11,7 +11,7 @@ services:
1111

1212
biixie_backend:
1313
image: biixie.com:backend-latest
14-
pull_policy: if_not_present
14+
pull_policy: always
1515
container_name: biixie_backend
1616
ports:
1717
- "3000:3000"

0 commit comments

Comments
 (0)