Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 29 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
FROM python:3.12-slim-bookworm AS builder
FROM python:3.12-slim-bookworm AS base

# Copy uv from external repository
COPY --from=ghcr.io/astral-sh/uv:0.5.4 /uv /uvx /bin/
# Python optimizations
ENV PYTHONUNBUFFERED=1
ENV UV_COMPILE_BYTECODE=1

# Set the working directory for the build stage
WORKDIR /app

# Copy only necessary files for installing dependencies
COPY ./pyproject.toml .
COPY ./uv.lock .
COPY ./README.md .
FROM base AS builder
COPY --from=ghcr.io/astral-sh/uv:0.5.4 /uv /bin/

# RUN uv cache dir
# RUN uv sync
COPY ./pyproject.toml ./uv.lock ./
COPY ./bases ./bases
COPY ./components ./components

RUN --mount=type=cache,id=uv_cache,target=/root/.cache/uv \
uv sync --frozen --no-dev

FROM base AS dev
COPY --from=ghcr.io/astral-sh/uv:0.5.4 /uv uvx/ /bin/

WORKDIR /app

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

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

COPY ./projects/api_public/pyproject.toml ./projects/api_public/uv.lock ./
COPY ./bases ./bases
COPY ./components ./components

# this isntalls dev dependencies
RUN --mount=type=cache,id=uv_cache,target=/root/.cache/uv \
uv sync --frozen

CMD [ "sleep", "infinity" ]
5 changes: 3 additions & 2 deletions docker-compose-dev.yml → docker-compose-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,18 @@ services:
build:
context: ./
dockerfile: Dockerfile
target: dev
# command: ["uv", "run", "bases/bot_detector/hiscore_scraper/core.py"]
# command: uv run uvicorn bases.bot_detector.api_public.src.core.server:app --host 0.0.0.0 --reload --port 5000
# command: uv run uvicorn bases.bot_detector.website.core.server:app --host 0.0.0.0 --reload --port 5000
# command: uv run uvicorn bases.bot_detector.api_ml.core.server:app --host 0.0.0.0 --reload --port 5000
ports:
- 5000:5000 # api_publics
- 5000 # api endpoint
- 8000 # metrics endpoint
volumes:
- ./bases:/app/bases
- ./components:/app/components
- ./projects:/app/projects
- uv_cache:/root/.cache/uv
command: ["sleep", "infinity"]
# network_mode: host # needed if we do any portforwarding from the cluster
networks:
Expand Down
Loading