Skip to content

Commit 9ffee01

Browse files
committed
Update workflow
1 parent aa8385d commit 9ffee01

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

.github/workflows/docker-backend.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ jobs:
2828
username: ${{ github.repository_owner }}
2929
password: ${{ secrets.GITHUB_TOKEN }}
3030

31+
- name: Build the Docker image
32+
run: docker build ./${{env.IMAGE_NAME}} --file ./${{env.IMAGE_NAME}}/Dockerfile --tag ${{env.IMAGE_NAME}}:${{ env.TIMESTAMP }}
33+
34+
- name: Save Docker image to file
35+
run: docker save ${{ env.IMAGE_TAG }} | gzip > iot-backend.tar.gz
36+
3137
- name: Connect Tailscale
3238
uses: tailscale/github-action@v2
3339
with:
@@ -37,4 +43,11 @@ jobs:
3743

3844
- name: Do the deploy thing
3945
run: |
40-
ssh -o "StrictHostKeyChecking no" $HOST@nilss-mac-mini ""
46+
ssh -o "StrictHostKeyChecking no" $HOST@nilss-mac-mini "
47+
cd ~/Projects/iot-home/deployment/backend
48+
gunzip -f iot-backend.tar.gz
49+
docker load < iot-backend.tar
50+
docker stop iot-backend || true
51+
docker rm iot-backend || true
52+
docker run -d --name iot-backend -p 3000:3000 ${{ env.IMAGE_NAME }}:${{ env.TIMESTAMP }}
53+
"

0 commit comments

Comments
 (0)