Skip to content

Commit e7a9c84

Browse files
finalizing autodeploy
1 parent ac073b1 commit e7a9c84

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

.github/workflows/deploy-prod.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,38 @@ jobs:
2121
- name: Get SHA
2222
id: vars
2323
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
24-
- name: Docker Build & Push
24+
25+
- name: Docker Build & Push ghopper-bus
26+
uses: docker/build-push-action@v2
27+
with:
28+
context: ./
29+
file: ./ghopper/ghopper-bus/Dockerfile
30+
push: true
31+
tags: cornellappdev/transit-ghopper:${{ steps.vars.outputs.sha_short }}
32+
- name: Remote SSH and Deploy ghopper-bus
33+
uses: appleboy/ssh-action@master
34+
env:
35+
IMAGE_TAG: ${{ steps.vars.outputs.sha_short }}
36+
with:
37+
host: ${{ secrets.GHOPPER_SERVER_HOST }}
38+
username: ${{ secrets.SERVER_USERNAME }}
39+
key: ${{ secrets.GHOPPER_SERVER_KEY }}
40+
script: |
41+
export IMAGE_TAG=${{ steps.vars.outputs.sha_short }}
42+
cd docker-compose
43+
docker stack rm the-stack
44+
sleep 20s
45+
docker stack deploy -c docker-compose.yml the-stack
46+
yes | docker system prune -a
47+
48+
- name: Docker Build & Push transit-prod
2549
uses: docker/build-push-action@v2
2650
with:
2751
context: ./
2852
file: ./Dockerfile
2953
push: true
3054
tags: cornellappdev/transit-prod:${{ steps.vars.outputs.sha_short }}
31-
- name: Remote SSH and Deploy
55+
- name: Remote SSH and Deploy transit-prod
3256
uses: appleboy/ssh-action@master
3357
env:
3458
IMAGE_TAG: ${{ steps.vars.outputs.sha_short }}

ghopper/docker-compose.ghopper.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
ghopper-bus:
3-
image: cornellappdev/transit-ghopper:latest
3+
image: cornellappdev/transit-ghopper:${IMAGE_TAG}
44
ports:
55
- "8988:8988"
66

0 commit comments

Comments
 (0)