26 lines
695 B
Docker
26 lines
695 B
Docker
FROM alpine:3.20 AS builder
|
|
|
|
RUN apk add --no-cache python3 poetry py3-poetry-plugin-export
|
|
|
|
RUN mkdir /source
|
|
WORKDIR /source
|
|
COPY pyproject.toml poetry.lock ./
|
|
|
|
RUN poetry export --output=requirements.txt
|
|
|
|
|
|
|
|
FROM alpine:3.20 AS runner
|
|
|
|
RUN addgroup web && adduser -D -G web web && install -d -D -o web -g web -m 700 /source
|
|
WORKDIR /source
|
|
RUN apk add --no-cache python3 py3-pip uvicorn
|
|
|
|
COPY --from=builder /source/requirements.txt /tmp
|
|
RUN pip install --break-system-packages --no-cache-dir --upgrade -r /tmp/requirements.txt && rm /tmp/requirements.txt
|
|
|
|
USER web
|
|
COPY --chown=web:web . .
|
|
|
|
ENTRYPOINT ["python", "-m", "uvicorn", "api_server.main:app", "--host", "0.0.0.0", "--port", "8080"]
|