Update Docker container to use FastAPI CLI directly

Remove package installation step and use FastAPI CLI with PYTHONPATH
for simpler container execution. Disable reload in main.py and include
static/templates as package data for proper distribution.
This commit is contained in:
2025-05-26 13:12:08 -04:00
parent 4db70b5113
commit d61c0fc5a5
3 changed files with 7 additions and 6 deletions
+3 -4
View File
@@ -23,6 +23,7 @@ COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONPATH="/app" \
PATH="/app/.venv/bin:$PATH"
WORKDIR /app
@@ -33,7 +34,5 @@ COPY --from=builder /app/.venv /app/.venv
# Copy application code
COPY . .
# Install the project itself
RUN uv pip install --no-deps .
CMD ["kjvstudy-org"]
# Run the application using FastAPI CLI
CMD ["fastapi", "run", "kjvstudy_org.server:app", "--host", "0.0.0.0", "--port", "8000"]
+1 -1
View File
@@ -8,7 +8,7 @@ def main():
"kjvstudy_org.server:app",
host="0.0.0.0",
port=8000,
reload=True,
reload=False,
log_level="info"
)
+3 -1
View File
@@ -23,7 +23,9 @@ build-backend = "setuptools.build_meta"
[tool.setuptools.packages.find]
where = ["."]
include = ["kjvstudy_org*"]
exclude = ["static", "templates"]
[tool.setuptools.package-data]
kjvstudy_org = ["static/*", "templates/*"]
[tool.uv]
package = true