-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
110 lines (73 loc) · 2.5 KB
/
Dockerfile
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
ARG BASE_IMAGE=senzing/senzingapi-runtime:3.12.0
# Create the runtime image.
ARG SENZING_ACCEPT_EULA="I_ACCEPT_THE_SENZING_EULA"
ARG SENZING_APT_INSTALL_TOOLS_PACKAGE="senzingapi-tools=3.12.0-24261"
# -----------------------------------------------------------------------------
# Stage: builder
# -----------------------------------------------------------------------------
FROM ${BASE_IMAGE} AS builder
ENV REFRESHED_AT=2024-09-26
# Run as "root" for system installation.
USER root
# Install packages via apt-get.
RUN apt-get update \
&& apt-get -y install \
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"
# Install packages via PIP.
COPY requirements.txt .
RUN pip3 install --upgrade pip \
&& pip3 install -r requirements.txt \
&& rm requirements.txt \
&& pip3 uninstall -y setuptools pip
# -----------------------------------------------------------------------------
# Stage: Final
# -----------------------------------------------------------------------------
# Create the runtime image.
FROM ${BASE_IMAGE} AS runner
ENV REFRESHED_AT=2024-09-26
ARG SENZING_ACCEPT_EULA
ARG SENZING_APT_INSTALL_TOOLS_PACKAGE
ENV SENZING_ACCEPT_EULA=${SENZING_ACCEPT_EULA} \
SENZING_APT_INSTALL_TOOLS_PACKAGE=${SENZING_APT_INSTALL_TOOLS_PACKAGE}
LABEL Name="senzing/senzingapi-tools" \
Maintainer="[email protected]" \
Version="3.12.0"
# Run as "root" for system installation.
USER root
# Eliminate warning messages.
ENV TERM=xterm
# Install Senzing package.
RUN apt-get update \
&& apt-get -y install ${SENZING_APT_INSTALL_TOOLS_PACKAGE}
HEALTHCHECK CMD apt list --installed | grep senzingapi-tools
# Install packages via apt.
RUN apt-get update \
&& apt-get -y install \
python3-venv \
&& rm -rf /var/lib/apt/lists/*
# Copy python virtual environment from the builder image.
COPY --from=builder /app/venv /app/venv
USER 1001
# Activate virtual environment.
ENV VIRTUAL_ENV=/app/venv
ENV PATH="/app/venv/bin:${PATH}"
# Set environment variables for root.
ENV LANGUAGE=C \
LC_ALL=C.UTF-8 \
LD_LIBRARY_PATH=/opt/senzing/g2/lib \
PATH=${PATH}:/opt/senzing/g2/python \
PYTHONPATH=/opt/senzing/g2/python:/opt/senzing/g2/sdk/python \
PYTHONUNBUFFERED=1 \
SENZING_DOCKER_LAUNCHED=true \
SENZING_SKIP_DATABASE_PERFORMANCE_TEST=true
# Runtime execution.
WORKDIR /
CMD ["/bin/bash"]