Files
syncio/Dockerfile
2026-04-16 17:57:58 +09:00

50 lines
921 B
Docker

FROM python:3.12-alpine AS builder
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
WORKDIR /app
RUN apk add --no-cache \
build-base \
freetds \
freetds-dev \
linux-headers \
postgresql-dev \
python3-dev \
tzdata
COPY req.txt .
RUN pip install --upgrade pip \
&& pip wheel --wheel-dir /wheels -r req.txt
FROM python:3.12-alpine AS runtime
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
WORKDIR /app
RUN apk add --no-cache \
freetds \
libpq \
tzdata
COPY req.txt .
COPY --from=builder /wheels /wheels
RUN pip install --upgrade pip \
&& pip install --no-index --find-links=/wheels -r req.txt \
&& rm -rf /wheels
COPY app ./app
COPY main.py .
COPY sql ./sql
RUN mkdir -p logs
EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]