Skip to content

Commit 04cea56

Browse files
committed
updates
1 parent dd8cce4 commit 04cea56

21 files changed

Lines changed: 40 additions & 65 deletions

.github/workflows/main.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ jobs:
1111
name: Build Docker Image
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Checkout master
15-
uses: actions/checkout@v2.3.4
14+
- name: Checkout
15+
uses: actions/checkout@v2.4.0
16+
with:
17+
ref: main
1618
- name: Log in to GitHub Packages
1719
run: echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_ACTOR} --password-stdin docker.pkg.github.com
1820
env:
@@ -44,8 +46,10 @@ jobs:
4446
runs-on: ubuntu-latest
4547
needs: build
4648
steps:
47-
- name: Checkout master
48-
uses: actions/checkout@v2.3.4
49+
- name: Checkout
50+
uses: actions/checkout@v2.4.0
51+
with:
52+
ref: main
4953
- name: Log in to GitHub Packages
5054
run: echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_ACTOR} --password-stdin docker.pkg.github.com
5155
env:
@@ -74,11 +78,12 @@ jobs:
7478
--name fastapi-tdd \
7579
-e PORT=8765 \
7680
-e ENVIRONMENT=dev \
81+
-e DATABASE_URL=sqlite://sqlite.db \
7782
-e DATABASE_TEST_URL=sqlite://sqlite.db \
7883
-p 5003:8765 \
7984
${{ env.IMAGE }}-final:latest
8085
- name: Install requirements
81-
run: docker exec fastapi-tdd pip install black==21.6b0 flake8==3.9.2 isort==5.9.1 pytest==6.2.4
86+
run: docker exec fastapi-tdd pip install black==21.12b0 flake8==4.0.1 isort==5.10.1 pytest==6.2.5
8287
- name: Pytest
8388
run: docker exec fastapi-tdd python -m pytest .
8489
- name: Flake8
@@ -93,11 +98,13 @@ jobs:
9398
runs-on: ubuntu-latest
9499
needs: [build, test]
95100
env:
96-
HEROKU_APP_NAME: thawing-beach-87010
101+
HEROKU_APP_NAME: sleepy-thicket-77414
97102
HEROKU_REGISTRY_IMAGE: registry.heroku.com/${HEROKU_APP_NAME}/summarizer
98103
steps:
99-
- name: Checkout master
100-
uses: actions/checkout@v2.3.4
104+
- name: Checkout
105+
uses: actions/checkout@v2.4.0
106+
with:
107+
ref: main
101108
- name: Log in to GitHub Packages
102109
run: echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_ACTOR} --password-stdin docker.pkg.github.com
103110
env:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Test-Driven Development with FastAPI and Docker
22

3-
![Continuous Integration and Delivery](https://github.com/testdrivenio/fastapi-tdd-docker/workflows/Continuous%20Integration%20and%20Delivery/badge.svg?branch=master)
3+
![Continuous Integration and Delivery](https://github.com/testdrivenio/fastapi-tdd-docker/workflows/Continuous%20Integration%20and%20Delivery/badge.svg?branch=main)
44

55
https://testdriven.io/courses/tdd-fastapi/

project/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pull official base image
2-
FROM python:3.9.6-slim-buster
2+
FROM python:3.10.1-slim-buster
33

44
# set working directory
55
WORKDIR /usr/src/app

project/Dockerfile.prod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
###########
44

55
# pull official base image
6-
FROM python:3.8.11-slim-buster as builder
6+
FROM python:3.10.1-slim-buster as builder
77

88
# install system dependencies
99
RUN apt-get update \
@@ -24,7 +24,7 @@ RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requir
2424

2525
# lint
2626
COPY . /usr/src/app/
27-
RUN pip install black==21.6b0 flake8==3.9.2 isort==5.9.1
27+
RUN pip install black==21.12b0 flake8==4.0.1 isort==5.10.1
2828
RUN flake8 .
2929
RUN black --exclude=migrations .
3030
RUN isort .
@@ -35,7 +35,7 @@ RUN isort .
3535
#########
3636

3737
# pull official base image
38-
FROM python:3.8.11-slim-buster
38+
FROM python:3.10.1-slim-buster
3939

4040
# create directory for the app user
4141
RUN mkdir -p /home/app
@@ -65,7 +65,7 @@ COPY --from=builder /usr/src/app/wheels /wheels
6565
COPY --from=builder /usr/src/app/requirements.txt .
6666
RUN pip install --upgrade pip
6767
RUN pip install --no-cache /wheels/*
68-
RUN pip install "uvicorn[standard]==0.14.0"
68+
RUN pip install "uvicorn[standard]==0.16.0"
6969

7070
# add app
7171
COPY . .

project/aerich.ini

Lines changed: 0 additions & 3 deletions
This file was deleted.

project/app/api/crud.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# project/app/api/crud.py
2-
3-
41
from typing import List, Union
52

63
from app.models.pydantic import SummaryPayloadSchema
@@ -16,7 +13,7 @@ async def post(payload: SummaryPayloadSchema) -> int:
1613
async def get(id: int) -> Union[dict, None]:
1714
summary = await TextSummary.filter(id=id).first().values()
1815
if summary:
19-
return summary[0]
16+
return summary
2017
return None
2118

2219

@@ -36,5 +33,5 @@ async def put(id: int, payload: SummaryPayloadSchema) -> Union[dict, None]:
3633
)
3734
if summary:
3835
updated_summary = await TextSummary.filter(id=id).first().values()
39-
return updated_summary[0]
36+
return updated_summary
4037
return None

project/app/api/ping.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# project/app/api/ping.py
2-
3-
41
from fastapi import APIRouter, Depends
52

63
from app.config import Settings, get_settings

project/app/api/summaries.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# project/app/api/summaries.py
2-
3-
41
from typing import List
52

63
from fastapi import APIRouter, BackgroundTasks, HTTPException, Path

project/app/config.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# project/app/config.py
2-
3-
41
import logging
52
import os
63
from functools import lru_cache

project/app/db.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# project/app/db.py
2-
3-
41
import logging
52
import os
63

0 commit comments

Comments
 (0)