-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
96 lines (67 loc) · 2.27 KB
/
Dockerfile
File metadata and controls
96 lines (67 loc) · 2.27 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# -----------------------------------------------------------------------------
# Stages
# -----------------------------------------------------------------------------
ARG IMAGE_FINAL=debian:13-slim@sha256:f6e2cfac5cf956ea044b4bd75e6397b4372ad88fe00908045e9a0d21712ae3ba
# -----------------------------------------------------------------------------
# Stage: builder
# -----------------------------------------------------------------------------
FROM ${IMAGE_FINAL} AS builder
ENV REFRESHED_AT=2026-01-05
LABEL Name="senzing/python-builder" \
Maintainer="support@senzing.com" \
Version="1.2.8"
# Run as "root" for system installation.
USER root
# Install packages via apt-get.
RUN apt-get update \
&& apt-get -y --no-install-recommends install \
git \
python3 \
python3-dev \
python3-pip \
python3-venv \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Create and activate virtual environment.
RUN python3 -m venv /app/venv
ENV PATH="/app/venv/bin:$PATH"
COPY . /git-repository
WORKDIR /git-repository
# Install packages via PIP.
RUN python3 -m pip install --upgrade pip \
&& python3 -m pip install . \
&& python3 -m pip install build
# Build Python wheel file.
RUN cp src/template_python/template-python.py src/template_python/main_entry.py \
&& python3 -m build \
&& python3 -m pip install dist/*.whl
# -----------------------------------------------------------------------------
# Stage: final
# -----------------------------------------------------------------------------
FROM ${IMAGE_FINAL} AS final
ENV REFRESHED_AT=2026-01-05
LABEL Name="senzing/template-python" \
Maintainer="support@senzing.com" \
Version="1.2.8"
HEALTHCHECK CMD ["/app/healthcheck.sh"]
USER root
# Install packages via apt-get.
RUN apt-get update \
&& apt-get -y --no-install-recommends install \
python3 \
python3-pip \
python3-venv \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy files from repository.
COPY ./rootfs /
# Copy files from prior stage.
COPY --from=builder /app/venv /app/venv
# Run as non-root container
USER 1001
# Runtime environment variables.
ENV VIRTUAL_ENV=/app/venv
ENV PATH="/app/venv/bin:${PATH}"
ENV LD_LIBRARY_PATH=/opt/senzing/g2/lib/
# Runtime execution.
ENTRYPOINT ["template_python"]