-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathContainerfile.marketplace-handler
More file actions
60 lines (46 loc) · 2.13 KB
/
Containerfile.marketplace-handler
File metadata and controls
60 lines (46 loc) · 2.13 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
# Marketplace Handler - Container Image
# Handles DCR and Pub/Sub events for Google Cloud Marketplace integration
# Built on Red Hat Universal Base Image (UBI)
# =============================================================================
# Build Stage
# =============================================================================
FROM registry.access.redhat.com/ubi10/python-312-minimal:latest as builder
WORKDIR /opt/app-root/src
# Install Python dependencies
COPY pyproject.toml README.md ./
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir "."
# =============================================================================
# Production Stage
# =============================================================================
FROM registry.access.redhat.com/ubi10/python-312-minimal:latest as production
# Labels for container metadata
LABEL org.opencontainers.image.title="Marketplace Handler"
LABEL org.opencontainers.image.description="DCR and Pub/Sub handler for Red Hat Lightspeed Agent for Google Cloud"
LABEL org.opencontainers.image.vendor="Red Hat"
LABEL org.opencontainers.image.licenses="Apache-2.0"
LABEL io.k8s.display-name="Marketplace Handler"
LABEL io.k8s.description="Handles Google Cloud Marketplace provisioning and DCR"
WORKDIR /opt/app-root/src
# Copy installed packages from builder
COPY --from=builder /opt/app-root/lib/python3.12/site-packages /opt/app-root/lib/python3.12/site-packages
# Copy application code
COPY src/ ./src/
COPY pyproject.toml README.md ./
# Install the application
RUN pip install --no-cache-dir -e .
# Create directory for data (if using SQLite)
RUN mkdir -p /opt/app-root/src/data
# Environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
HANDLER_HOST=0.0.0.0 \
HANDLER_PORT=8001
# Expose the handler port
EXPOSE 8001
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import httpx; httpx.get('http://localhost:8001/health').raise_for_status()"
# UBI images already run as non-root user (UID 1001)
# Default command - run the marketplace handler
CMD ["python", "-m", "lightspeed_agent.marketplace"]