-
Notifications
You must be signed in to change notification settings - Fork 8
feat: add fastapi docker #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: Pete Gadomski <pete.gadomski@gmail.com>
Co-authored-by: Pete Gadomski <pete.gadomski@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got this error when building locally:
=> ERROR [4/4] RUN uv sync --frozen 0.3s
------
> [4/4] RUN uv sync --frozen:
0.289 Using CPython 3.12.9 interpreter at: /usr/local/bin/python3
0.289 Creating virtual environment at: .venv
0.301 error: Failed to determine installation plan
0.301 Caused by: Distribution not found at: file:///app/pystapi-validator
------
1 warning found (use docker --debug to expand):
- FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 4)
Dockerfile:9
--------------------
7 | COPY . /app
8 |
9 | >>> RUN uv sync --frozen
10 |
11 | CMD ["uv", "run", "fastapi", "dev", "/app/stapi-fastapi/tests/application.py", "--host", "0.0.0.0", "--port", "80"]
--------------------
ERROR: failed to solve: process "/bin/sh -c uv sync --frozen" did not complete successfully: exit code: 2
I think it would make sense to build the dockerfile (but not push it) in ci.yaml as well, to ensure it builds ok?
Co-authored-by: Pete Gadomski <pete.gadomski@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still getting this error when building locally:
=> ERROR [4/4] RUN uv sync --frozen 0.3s
------
> [4/4] RUN uv sync --frozen:
0.270 Using CPython 3.12.9 interpreter at: /usr/local/bin/python3
0.270 Creating virtual environment at: .venv
0.279 error: Failed to determine installation plan
0.279 Caused by: Distribution not found at: file:///app/pystapi-validator
------
Dockerfile:9
--------------------
7 | COPY . /app
8 |
9 | >>> RUN uv sync --frozen
10 |
11 | CMD ["uv", "run", "fastapi", "dev", "/app/stapi-fastapi/tests/application.py", "--host", "0.0.0.0", "--port", "80"]
--------------------
ERROR: failed to solve: process "/bin/sh -c uv sync --frozen" did not complete successfully: exit code: 2
View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/ogrcl2mcd2tj2mk5gua86tsyt
|
Should work now @gadomski |
What I'm changing
.dockerignorethat defines the files that get moved into the docker image.Dockerfilethat installs the Python package based on the uv lock file and executes the FastAPI application.closes #48
How I did it
Checklist
uv run pytestuv run pre-commit --all-files