Skip to content

Commit f030408

Browse files
adding autodeploy for dev
1 parent b311220 commit f030408

File tree

2 files changed

+24
-45
lines changed

2 files changed

+24
-45
lines changed

.github/workflows/deploy-dev.yml

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,56 +11,35 @@ jobs:
1111
steps:
1212
- name: Checkout
1313
uses: actions/checkout@v2
14-
1514
- name: Set up Docker Buildx
1615
uses: docker/setup-buildx-action@v1
17-
1816
- name: Login to DockerHub
1917
uses: docker/login-action@v1
2018
with:
2119
username: ${{ secrets.DOCKER_USERNAME }}
2220
password: ${{ secrets.DOCKER_PASSWORD }}
23-
24-
# - name: Get SHA
25-
# id: vars
26-
# run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
27-
28-
- name: Docker Build & Push ghopper
29-
uses: docker/build-push-action@v2
30-
with:
31-
context: ./docker-compose/ghopper
32-
file: ./docker-compose/ghopper/Dockerfile
33-
push: true
34-
tags: cornellappdev/transit-ghopper:latest
35-
36-
- name: Docker Build & Push ghopper-walking
21+
- name: Get SHA
22+
id: vars
23+
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
24+
- name: Docker Build & Push
3725
uses: docker/build-push-action@v2
3826
with:
39-
context: ./docker-compose/ghopper-walking
40-
file: ./docker-compose/ghopper-walking/Dockerfile
27+
context: ./
28+
file: ./Dockerfile
4129
push: true
42-
tags: cornellappdev/transit-ghopper-walking:latest
43-
44-
- name: Docker Build & Push map
45-
uses: docker/build-push-action@v2
30+
tags: cornellappdev/transit-dev:${{ steps.vars.outputs.sha_short }}
31+
- name: Remote SSH and Deploy
32+
uses: appleboy/ssh-action@master
33+
env:
34+
IMAGE_TAG: ${{ steps.vars.outputs.sha_short }}
4635
with:
47-
context: ./docker-compose/map
48-
file: ./docker-compose/map/Dockerfile
49-
push: true
50-
tags: cornellappdev/transit-map:latest
51-
52-
# - name: Remote SSH and Deploy
53-
# uses: appleboy/ssh-action@master
54-
# env:
55-
# IMAGE_TAG: ${{ steps.vars.outputs.sha_short }}
56-
# with:
57-
# host: ${{ secrets.DEV_SERVER_HOST }}
58-
# username: ${{ secrets.SERVER_USERNAME }}
59-
# key: ${{ secrets.DEV_SERVER_KEY }}
60-
# script: |
61-
# export IMAGE_TAG=${{ steps.vars.outputs.sha_short }}
62-
# cd docker-compose
63-
# docker stack rm the-stack
64-
# sleep 20s
65-
# docker stack deploy -c docker-compose.yml the-stack
66-
# yes | docker system prune -a
36+
host: ${{ secrets.DEV_SERVER_HOST }}
37+
username: ${{ secrets.SERVER_USERNAME }}
38+
key: ${{ secrets.DEV_SERVER_KEY }}
39+
script: |
40+
export IMAGE_TAG=${{ steps.vars.outputs.sha_short }}
41+
cd docker-compose
42+
docker stack rm the-stack
43+
sleep 20s
44+
docker stack deploy -c docker-compose.yml the-stack
45+
yes | docker system prune -a

docker-compose/map/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ RUN git clone --single-branch -b tcat-map https://github.com/cuappdev/ithaca-tra
77

88
WORKDIR /usr/src/app
99

10-
RUN git clone --single-branch -b master https://github.com/graphhopper/map-matching.git
10+
RUN git clone --single-branch -b 0.11 https://github.com/graphhopper/map-matching.git
1111

1212
WORKDIR /usr/src/app/map-matching
1313

1414
RUN mvn package -e -DskipTests
15-
RUN java -jar matching-web/target/graphhopper-map-matching-web-*.jar import ../map.osm --vehicle=car,foot
15+
RUN java -jar matching-web/target/graphhopper-map-matching-web-0.11-SNAPSHOT.jar import ../map.osm --vehicle=car,foot
1616

1717
COPY config.yml .
1818

1919
EXPOSE 8989
2020

21-
CMD java -jar matching-web/target/graphhopper-map-matching-web-*.jar server config.yml
21+
CMD java -jar matching-web/target/graphhopper-map-matching-web-0.11-SNAPSHOT.jar server config.yml

0 commit comments

Comments
 (0)