-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (43 loc) · 1.97 KB
/
Dockerfile
File metadata and controls
60 lines (43 loc) · 1.97 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
54
55
56
57
58
59
60
# ---------------------------------------------------------------------------------------
# BUILDER
# ---------------------------------------------------------------------------------------
FROM python:3.12-slim-bookworm AS builder
VOLUME ["/root/.config"]
# Use uv for high-speed installs
COPY --from=ghcr.io/astral-sh/uv:0.10.9 /uv /usr/local/bin/uv
ENV UV_COMPILE_BYTECODE=1
COPY pyproject.toml requirements.txt README.md MANIFEST.in ./
COPY src ./src
RUN uv pip install --system --upgrade pip && \
uv pip install --system build && \
uv pip install --system --prefix=/install -r requirements.txt && \
uv pip install --system --prefix=/install --no-deps .
# ---------------------------------------------------------------------------------------
# PRODUCTION IMAGE
# ---------------------------------------------------------------------------------------
FROM python:3.12-slim-bookworm AS prod
ENV PYTHONUNBUFFERED=1
# Copy the pre-compiled packages from builder
COPY --from=builder /install /usr/local
# APACHE BEAM INTEGRATION (Uncomment if needed)
# COPY --from=apache/beam_python3.12_sdk:2.71.0 /opt/apache/beam /opt/apache/beam
# ENTRYPOINT ["/opt/apache/beam/boot"]
WORKDIR /opt/project
# ---------------------------------------------------------------------------------------
# DEVELOPMENT IMAGE
# ---------------------------------------------------------------------------------------
FROM builder AS dev
WORKDIR /opt/project
COPY . .
RUN uv pip install --system -e .[lint,dev,build] && \
uv pip install --system -r requirements-test.txt
# ---------------------------------------------------------------------------------------
# TEST IMAGE
# ---------------------------------------------------------------------------------------
FROM prod AS test
COPY ./requirements-test.txt .
RUN pip install -r requirements-test.txt
COPY ./tests ./tests
# Suppress all warnings during tests
# To see/address warnings, run tests in your development environment.
ENV PYTHONWARNINGS=ignore