Skip to content

Commit 9007661

Browse files
Merge branch 'fastapi:master' into refactor-status-code
2 parents 1c1a1be + b262c20 commit 9007661

File tree

10 files changed

+25
-24
lines changed

10 files changed

+25
-24
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ jobs:
2626
- run: docker compose down -v --remove-orphans
2727
- run: docker compose up -d
2828
- name: Lint
29-
run: docker compose exec -T backend bash /app/scripts/lint.sh
29+
run: docker compose exec -T backend bash scripts/lint.sh
3030
- name: Run tests
31-
run: docker compose exec -T backend bash /app/tests-start.sh "Coverage for ${{ github.sha }}"
31+
run: docker compose exec -T backend bash scripts/tests-start.sh "Coverage for ${{ github.sha }}"
3232
- run: docker compose down -v --remove-orphans
3333
- name: Store coverage files
3434
uses: actions/upload-artifact@v4

backend/Dockerfile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.10
1+
FROM python:3.10
22

33
WORKDIR /app/
44

@@ -17,14 +17,10 @@ RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; els
1717

1818
ENV PYTHONPATH=/app
1919

20-
COPY ./scripts/ /app/
20+
COPY ./scripts /app/scripts
2121

2222
COPY ./alembic.ini /app/
2323

24-
COPY ./prestart.sh /app/
25-
26-
COPY ./tests-start.sh /app/
27-
2824
COPY ./app /app/app
2925

3026
CMD ["fastapi", "run", "--workers", "4", "app/main.py"]

backend/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ If you use GitHub Actions the tests will run automatically.
106106
If your stack is already up and you just want to run the tests, you can use:
107107

108108
```bash
109-
docker compose exec backend bash /app/tests-start.sh
109+
docker compose exec backend bash scripts/tests-start.sh
110110
```
111111

112-
That `/app/tests-start.sh` script just calls `pytest` after making sure that the rest of the stack is running. If you need to pass extra arguments to `pytest`, you can pass them to that command and they will be forwarded.
112+
That `/app/scripts/tests-start.sh` script just calls `pytest` after making sure that the rest of the stack is running. If you need to pass extra arguments to `pytest`, you can pass them to that command and they will be forwarded.
113113

114114
For example, to stop on first error:
115115

116116
```bash
117-
docker compose exec backend bash /app/tests-start.sh -x
117+
docker compose exec backend bash scripts/tests-start.sh -x
118118
```
119119

120120
### Test Coverage
@@ -155,7 +155,7 @@ If you don't want to use migrations at all, uncomment the lines in the file at `
155155
SQLModel.metadata.create_all(engine)
156156
```
157157

158-
and comment the line in the file `prestart.sh` that contains:
158+
and comment the line in the file `scripts/prestart.sh` that contains:
159159

160160
```console
161161
$ alembic upgrade head
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#! /usr/bin/env bash
22

3+
set -e
4+
set -x
5+
36
# Let the DB start
4-
python /app/app/backend_pre_start.py
7+
python app/backend_pre_start.py
58

69
# Run migrations
710
alembic upgrade head
811

912
# Create initial data in DB
10-
python /app/app/initial_data.py
13+
python app/initial_data.py

backend/scripts/tests-start.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /usr/bin/env bash
2+
set -e
3+
set -x
4+
5+
python app/tests_pre_start.py
6+
7+
bash scripts/test.sh "$@"

backend/tests-start.sh

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

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ services:
5555
db:
5656
condition: service_healthy
5757
restart: true
58-
command: bash prestart.sh
58+
command: bash scripts/prestart.sh
5959
env_file:
6060
- .env
6161
environment:

release-notes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
### Refactors
1212

13+
* 🔧 Use plain base official Python Docker image. PR [#1351](https://github.com/fastapi/full-stack-fastapi-template/pull/1351) by [@tiangolo](https://github.com/tiangolo).
14+
* 🚚 Move location of scripts to simplify file structure. PR [#1352](https://github.com/fastapi/full-stack-fastapi-template/pull/1352) by [@tiangolo](https://github.com/tiangolo).
1315
* ♻️ Refactor prestart (migrations), move that to its own container. PR [#1350](https://github.com/fastapi/full-stack-fastapi-template/pull/1350) by [@tiangolo](https://github.com/tiangolo).
1416
* ♻️ Include `FRONTEND_HOST` in CORS origins by default. PR [#1348](https://github.com/fastapi/full-stack-fastapi-template/pull/1348) by [@tiangolo](https://github.com/tiangolo).
1517
* ♻️ Simplify domains with `api.example.com` for API and `dashboard.example.com` for frontend, improve local development with `localhost`. PR [#1344](https://github.com/fastapi/full-stack-fastapi-template/pull/1344) by [@tiangolo](https://github.com/tiangolo).

scripts/test-local.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ fi
1212

1313
docker-compose build
1414
docker-compose up -d
15-
docker-compose exec -T backend bash /app/tests-start.sh "$@"
15+
docker-compose exec -T backend bash scripts/tests-start.sh "$@"

scripts/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ set -x
77
docker compose build
88
docker compose down -v --remove-orphans # Remove possibly previous broken stacks left hanging after an error
99
docker compose up -d
10-
docker compose exec -T backend bash /app/tests-start.sh "$@"
10+
docker compose exec -T backend bash scripts/tests-start.sh "$@"
1111
docker compose down -v --remove-orphans

0 commit comments

Comments
 (0)