## ------------------------------- Builder Stage ------------------------------ ##
FROM docker.io/python:3.13-bookworm AS builder
RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential && \
apt-get clean && rm -rf /var/lib/apt/lists/*
ADD https://astral.sh/uv/install.sh /install.sh
RUN chmod -R 655 /install.sh && /install.sh && rm /install.sh
ENV PATH="/root/.local/bin:$PATH"
WORKDIR /app
COPY ./pyproject.toml .
RUN uv sync
## ------------------------------- Production Stage ------------------------------ ##
FROM docker.io/python:3.13-slim-bookworm AS production
WORKDIR /app
RUN apt-get update -y \
&& apt-get install -y make \
&& apt-get purge -y --auto-remove \
&& rm -rf /var/lib/apt/lists/*
COPY /cyber_valley cyber_valley
COPY /ethereum_artifacts_temp ethereum_artifacts
COPY manage.py .
COPY Makefile .
COPY --from=builder /app/.venv .venv
ENV PATH="/app/.venv/bin:$PATH"
ENTRYPOINT ["make"]