-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (41 loc) · 1.42 KB
/
Copy pathDockerfile
File metadata and controls
55 lines (41 loc) · 1.42 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
# syntax=docker/dockerfile:1
###############################################
# Stage 1 — Build dependencies + install package
###############################################
FROM python:3.12-slim AS builder
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /build
# Install build toolchain (needed for wheels)
RUN apt-get update && \
apt-get install -y --no-install-recommends gcc && \
rm -rf /var/lib/apt/lists/*
# Copy only project metadata first (cache-friendly)
COPY pyproject.toml .
COPY README.md .
COPY jenkinsctl ./jenkinsctl
# If you add tests or other folders later, include only what’s required
# Install dependencies + build wheels
RUN pip install --upgrade pip && \
pip wheel --no-cache-dir --wheel-dir /build/wheels .
###############################################
# Stage 2 — Minimal runtime image
###############################################
FROM python:3.12-slim AS runtime
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
# Install only the built wheels — NO compilers, NO build deps
COPY --from=builder /build/wheels /wheels
RUN pip install --no-cache /wheels/*
# Optional: define overridable env vars
ENV JENKINS_SERVER_URL=""
ENV JENKINS_USERNAME=""
ENV JENKINS_API_KEY=""
# Create non-root user
RUN useradd -m -u 1000 jenkinsctl && \
chown -R jenkinsctl:jenkinsctl /app
USER jenkinsctl
# Default entrypoint — pure CLI
ENTRYPOINT ["jenkinsctl"]
CMD ["--help"]