You've already forked favicon-api-v3
25.09.01
This commit is contained in:
29
Dockerfile
29
Dockerfile
@@ -1,16 +1,33 @@
|
||||
FROM python:3.12-slim
|
||||
FROM python:3.12-slim AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /app/wheels -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN python -m compileall -b .
|
||||
|
||||
FROM python:3.12-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/wheels /wheels
|
||||
COPY --from=builder /app/requirements.txt .
|
||||
RUN pip install --no-cache /wheels/*
|
||||
|
||||
COPY --from=builder /app /app
|
||||
|
||||
RUN find . -type d -name "__pycache__" | while read -r dir; do \
|
||||
module_dir=$(dirname "$dir"); \
|
||||
mv "$dir"/*.pyc "$module_dir/"; \
|
||||
rmdir "$dir"; \
|
||||
done
|
||||
|
||||
RUN find . -name "*.py" -delete
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
# CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
|
||||
# CMD ["gunicorn", "-w", "4", "-k", "uvicorn.workers.UvicornWorker", "-b", "0.0.0.0:8000", "main:app"]
|
||||
CMD ["gunicorn", "--config", "gunicorn.conf.py", "main:app"]
|
||||
CMD ["gunicorn", "--config", "gunicorn.conf.pyc", "main:app"]
|
||||
|
||||
Reference in New Issue
Block a user