-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (25 loc) · 1.25 KB
/
Copy pathDockerfile
File metadata and controls
36 lines (25 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Blog-to-Audio API — FastAPI backend for Coolify (Hetzner VPS)
# Frontend: Vercel (frontend/). Backend: repo root — Base directory ".", Dockerfile "./Dockerfile"
# Coolify: PORT=3000, Ports Mappings e.g. 5005:3000, Traefik loadbalancer.server.port=3000
# Local: docker run -p 8000:8000 -e PORT=8000 blog-to-audio-api
# See docs/DOCKER_VPS_BACKEND_PLAYBOOK.md for lean-Docker checklist and VPS cleanup.
FROM python:3.12-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PORT=3000
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends ffmpeg ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY main.py .
RUN mkdir -p audio_files \
&& groupadd --system --gid 10001 appgroup \
&& useradd --system --uid 10001 --gid appgroup --home-dir /app --no-create-home appuser \
&& chown -R appuser:appgroup /app
USER appuser
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \
CMD sh -c 'python -c "import urllib.request,os; p=os.environ.get(\"PORT\",\"3000\"); urllib.request.urlopen(\"http://127.0.0.1:\"+p+\"/api/health\")"' || exit 1
CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port ${PORT}"]