-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (40 loc) · 1.74 KB
/
Copy pathDockerfile
File metadata and controls
53 lines (40 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
################################################################################
# Shared base.
FROM ghcr.io/astral-sh/uv:python3.13-trixie AS base
ENV UV_NO_DEV=1
ENV UV_LINK_MODE=copy
WORKDIR /app
################################################################################
################################################################################
# target: Python only (lightweight).
FROM base AS python
COPY pyproject.toml uv.lock ./
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --no-install-project
COPY python ./python
CMD [".venv/bin/scrapy", "runspider", "python/elo/bga_spider.py"]
################################################################################
################################################################################
# Helper: Rust.
FROM base AS rust-base
ENV PATH="/root/.cargo/bin:$PATH"
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates \
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& apt-get purge -y curl \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
################################################################################
################################################################################
# target: Rust & Python (full).
FROM rust-base AS rust
COPY Cargo.toml Cargo.lock* ./
COPY pyproject.toml uv.lock ./
COPY rust ./rust
COPY python ./python
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=cache,target=/root/.cargo/registry \
--mount=type=cache,target=/root/.cargo/git \
uv sync --locked
CMD ["uv", "run", "scrapy", "runspider", "python/elo/bga_spider.py"]
################################################################################