Files
pdf-toolkit/Dockerfile.api
CM Consultor bb03663921 fix: add wget to Dockerfile.api and Dockerfile.web for Swarm healthcheck
O docker-compose.yaml de produção usa wget no healthcheck
(CMD-SHELL), mas python:3.12-slim não inclui wget por padrão.
2026-08-09 04:12:24 +00:00

26 lines
858 B
Docker

# Imagem única para API FastAPI — pronta para Docker Swarm.
# Build: docker build -t pdf-toolkit-api:1.0.0 -f Dockerfile.api .
FROM python:3.12-slim
WORKDIR /app
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1
# wget para healthcheck do Swarm (CMD-SHELL no docker-compose.yaml de produção)
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8555
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "import http.client; conn=http.client.HTTPConnection('localhost:8555'); conn.request('GET','/health'); r=conn.getresponse(); exit(0 if r.status==200 else 1)"
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8555"]