-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathContainerfile
More file actions
62 lines (48 loc) · 1.61 KB
/
Containerfile
File metadata and controls
62 lines (48 loc) · 1.61 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
61
62
# Multi-stage build for arroyopy
#
# Build examples:
# Basic: podman build -t arroyopy .
# With ZMQ: podman build --build-arg EXTRAS=zmq -t arroyopy:zmq .
# With Redis: podman build --build-arg EXTRAS=redis -t arroyopy:redis .
# Full stack: podman build --build-arg EXTRAS="zmq,redis,file-watch" -t arroyopy:full .
#
# Run examples:
# podman run arroyopy --help
# podman run -v ./config:/config arroyopy run /config/pipeline.yaml
#
# Build arguments for optional dependencies
ARG EXTRAS=""
FROM python:3.12-slim AS builder
WORKDIR /app
# Install build dependencies
RUN pip install --no-cache-dir build
# Copy only what's needed for building
COPY pyproject.toml README.md LICENSE* ./
COPY src/ ./src/
# Build the wheel
RUN python -m build --wheel
# Final runtime image
FROM python:3.12-slim
ARG EXTRAS
WORKDIR /app
# Install runtime dependencies and the built wheel
COPY --from=builder /app/dist/*.whl /tmp/
# Install with optional extras if specified
RUN if [ -z "$EXTRAS" ]; then \
pip install --no-cache-dir /tmp/*.whl; \
else \
pip install --no-cache-dir "/tmp/*.whl[$EXTRAS]"; \
fi && \
rm /tmp/*.whl
# Create a non-root user
RUN useradd -m -u 1000 arroyo && \
chown -R arroyo:arroyo /app
USER arroyo
# Default command runs the CLI
ENTRYPOINT ["arroyo", "run"]
CMD ["--help"]
# Labels
LABEL org.opencontainers.image.title="arroyopy"
LABEL org.opencontainers.image.description="A library to simplify processing streams of data"
LABEL org.opencontainers.image.source="https://github.com/als-computing/arroyopy"
LABEL org.opencontainers.image.licenses="BSD-3-Clause"