first commit
This commit is contained in:
49
Dockerfile
Normal file
49
Dockerfile
Normal file
@@ -0,0 +1,49 @@
|
||||
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"]
|
||||
Reference in New Issue
Block a user