This repository was archived by the owner on May 18, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +58
-2
lines changed Expand file tree Collapse file tree 6 files changed +58
-2
lines changed Original file line number Diff line number Diff line change 83
83
run : docker exec fastapi-tdd python -m black . --check
84
84
- name : isort
85
85
run : docker exec fastapi-tdd python -m isort . --check-only
86
+
87
+ deploy :
88
+ name : Deploy to Heroku
89
+ runs-on : ubuntu-latest
90
+ needs : [build, test]
91
+ env :
92
+ HEROKU_APP_NAME : mighty-brook-75156
93
+ HEROKU_REGISTRY_IMAGE : registry.heroku.com/${HEROKU_APP_NAME}/summarizer
94
+ steps :
95
+ - name : Checkout
96
+
97
+ with :
98
+ ref : master
99
+ - name : Log in to GitHub Packages
100
+ run : echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_ACTOR} --password-stdin docker.pkg.github.com
101
+ env :
102
+ GITHUB_TOKEN : ${{ secrets.DOC_GH_TOKEN }}
103
+ - name : Pull image
104
+ run : |
105
+ docker pull ${{ env.IMAGE }}:latest || true
106
+ - name : Build image
107
+ run : |
108
+ docker build \
109
+ --build-arg POETRY_VERSION=1.1.12 \
110
+ --cache-from ${{ env.IMAGE }}:latest \
111
+ --tag ${{ env.HEROKU_REGISTRY_IMAGE }}:latest \
112
+ --file ./Dockerfile.prod \
113
+ "./"
114
+ - name : Log in to the Heroku Container Registry
115
+ run : docker login -u _ -p ${HEROKU_AUTH_TOKEN} registry.heroku.com
116
+ env :
117
+ HEROKU_AUTH_TOKEN : ${{ secrets.HEROKU_AUTH_TOKEN }}
118
+ - name : Push to the registry
119
+ run : docker push ${{ env.HEROKU_REGISTRY_IMAGE }}
120
+ - name : Set environment variables
121
+ run : |
122
+ echo "HEROKU_REGISTRY_IMAGE=${{ env.HEROKU_REGISTRY_IMAGE }}" >> $GITHUB_ENV
123
+ echo "HEROKU_AUTH_TOKEN=${{ secrets.HEROKU_AUTH_TOKEN }}" >> $GITHUB_ENV
124
+ - name : Release
125
+ run : |
126
+ chmod +x ./release.sh
127
+ ./release.sh
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ RUN apk add --no-cache py3-psycopg2~=2.8.6 \
35
35
libffi-dev~=3.3 \
36
36
musl-dev~=1.2.2 \
37
37
make~=4.3 \
38
+ && pip install --upgrade pip \
38
39
&& pip install --no-cache-dir poetry==${POETRY_VERSION} \
39
40
&& poetry config virtualenvs.create false \
40
41
&& poetry install \
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ RUN apk add --no-cache py3-psycopg2~=2.8.6 \
37
37
libffi-dev~=3.3 \
38
38
musl-dev~=1.2.2 \
39
39
make~=4.3 \
40
+ && pip install --upgrade pip \
40
41
&& pip install --no-cache-dir poetry==${POETRY_VERSION} \
41
42
&& poetry config virtualenvs.create false \
42
43
&& poetry install --no-dev \
Original file line number Diff line number Diff line change 11
11
@router .get ("/ping" )
12
12
async def pong (settings : Settings = Depends (get_settings )):
13
13
return {
14
- "ping" : "pong! " ,
14
+ "ping" : "pong" ,
15
15
"environment" : settings .environment ,
16
16
"testing" : settings .testing ,
17
17
}
Original file line number Diff line number Diff line change 7
7
def test_ping (test_app ):
8
8
response = test_app .get ("/ping" )
9
9
assert response .status_code == 200
10
- assert response .json () == {"environment" : "dev" , "ping" : "pong! " , "testing" : True }
10
+ assert response .json () == {"environment" : "dev" , "ping" : "pong" , "testing" : True }
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ set -e
4
+
5
+ IMAGE_ID=$( docker inspect ${HEROKU_REGISTRY_IMAGE} --format={{.Id}})
6
+ PAYLOAD=' {"updates": [{"type": "web", "docker_image": "' " $IMAGE_ID " ' "}]}'
7
+
8
+ curl -n -X PATCH https://api.heroku.com/apps/$HEROKU_APP_NAME /formation \
9
+ -d " ${PAYLOAD} " \
10
+ -H " Content-Type: application/json" \
11
+ -H " Accept: application/vnd.heroku+json; version=3.docker-releases" \
12
+ -H " Authorization: Bearer ${HEROKU_AUTH_TOKEN} "
You can’t perform that action at this time.
0 commit comments