refactor: split Dockerfile into Dockerfile.api + Dockerfile.web for Swarm
- Remove multi-stage Dockerfile (não compatível com Swarm) - Dockerfile.api: imagem standalone para API FastAPI - Dockerfile.web: imagem standalone para Streamlit - docker-compose.yml: aponta para os Dockerfiles separados - README.md: instruções de build individual + deploy Swarm
This commit is contained in:
24
Dockerfile.api
Normal file
24
Dockerfile.api
Normal file
@@ -0,0 +1,24 @@
|
||||
# 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
|
||||
|
||||
# Pillow wheel manylinux já inclui libjpeg, zlib, etc.
|
||||
# Nenhuma dep de sistema necessária.
|
||||
|
||||
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"]
|
||||
Reference in New Issue
Block a user