Skip to content

Commit 50f6571

Browse files
authored
Merge pull request #8 from cuappdev/daisy/deployment
Daisy/deployment
2 parents 77908ed + 3b4642f commit 50f6571

File tree

5 files changed

+118
-1
lines changed

5 files changed

+118
-1
lines changed

.github/workflows/deploy-dev.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Docker Build & Push and Deploy to dev for score-backend
2+
3+
on:
4+
push:
5+
branches: [master]
6+
workflow_dispatch:
7+
8+
jobs:
9+
path-context:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
- name: Set up Docker Buildx
15+
uses: docker/setup-buildx-action@v1
16+
- name: Login to DockerHub
17+
uses: docker/login-action@v1
18+
with:
19+
username: ${{ secrets.DOCKER_USERNAME }}
20+
password: ${{ secrets.DOCKER_PASSWORD }}
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
25+
uses: docker/build-push-action@v2
26+
with:
27+
context: ./
28+
file: ./Dockerfile
29+
push: true
30+
tags: cornellappdev/score-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 }}
35+
with:
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 thestack
43+
sleep 20s
44+
docker stack deploy -c docker-compose.yml thestack
45+
docker system prune -a

.github/workflows/deploy-prod.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Docker Build & Push and Deploy to prod for score-backend
2+
3+
on:
4+
push:
5+
branches: [release]
6+
workflow_dispatch:
7+
8+
jobs:
9+
path-context:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
- name: Set up Docker Buildx
15+
uses: docker/setup-buildx-action@v1
16+
- name: Login to DockerHub
17+
uses: docker/login-action@v1
18+
with:
19+
username: ${{ secrets.DOCKER_USERNAME }}
20+
password: ${{ secrets.DOCKER_PASSWORD }}
21+
- name: Get SHA
22+
id: vars
23+
run: echo "::set-output name=sha_short::$(git rev-parse --short release)"
24+
- name: Docker Build & Push
25+
uses: docker/build-push-action@v2
26+
with:
27+
context: ./
28+
file: ./Dockerfile
29+
push: true
30+
tags: cornellappdev/score:${{ 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 }}
35+
with:
36+
host: ${{ secrets.PROD_SERVER_HOST }}
37+
username: ${{ secrets.SERVER_USERNAME }}
38+
key: ${{ secrets.PROD_SERVER_KEY }}
39+
script: |
40+
export IMAGE_TAG=${{ steps.vars.outputs.sha_short }}
41+
cd docker-compose
42+
docker stack rm thestack
43+
sleep 20s
44+
docker stack deploy -c docker-compose.yml thestack
45+
docker system prune -a

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM python:3.9
2+
RUN mkdir -p /usr/src/app
3+
WORKDIR /usr/src/app
4+
COPY . .
5+
RUN pip3 install --upgrade pip
6+
RUN pip install -r requirements.txt
7+
CMD python app.py

docker-compose.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: "3.6"
2+
3+
services:
4+
web:
5+
build: .
6+
container_name: web
7+
ports:
8+
- "5000:5000"
9+
env_file:
10+
- .env
11+
environment:
12+
- MONGO_URI=${ATLAS_URI}
13+
- DB_NAME=${DB_NAME}
14+
networks:
15+
- app-network
16+
17+
networks:
18+
app-network:
19+
driver: bridge

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ graphene
44
pymongo
55
beautifulsoup4
66
requests
7-
pillow
7+
pillow
8+
Flask-APScheduler

0 commit comments

Comments
 (0)