Commit d9928692 authored by George Papathanail's avatar George Papathanail
Browse files

Add DOCKERFILE

parent b3c52a34
Loading
Loading
Loading
Loading
Loading

.dockerignore

0 → 100644
+0 −0

Empty file added.

+35 −0
Original line number Diff line number Diff line
FROM python:3.12-slim AS builder

WORKDIR /app

# DB build arg: base | postgres | mongo
ARG DB=base

COPY pyproject.toml ./

RUN python -m venv .venv && \
    .venv/bin/pip install --upgrade pip setuptools wheel && \
    if [ "$DB" = "postgres" ]; then \
        .venv/bin/pip install ".[postgres]"; \
    elif [ "$DB" = "mongo" ]; then \
        .venv/bin/pip install ".[mongo]"; \
    else \
        .venv/bin/pip install "."; \
    fi


FROM python:3.12-slim AS runtime

WORKDIR /app

COPY --from=builder /app/.venv /app/.venv
COPY open_exposure_gateway/ ./open_exposure_gateway/

ENV PATH="/app/.venv/bin:$PATH"
ENV PYTHONPATH="/app"
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1

EXPOSE 8080

CMD ["uvicorn", "open_exposure_gateway.app.main:app", "--host", "0.0.0.0", "--port", "8080"]