-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
113 lines (77 loc) · 2.52 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
111
112
113
ARG BASE_IMAGE=senzing/senzingapi-runtime:3.10.3
# -----------------------------------------------------------------------------
# Stage: builder
# -----------------------------------------------------------------------------
FROM ${BASE_IMAGE} AS builder
ENV REFRESHED_AT=2024-06-24
# Run as "root" for system installation.
USER root
# Install packages via apt-get.
RUN apt-get update \
&& apt-get -y install \
curl \
libaio1 \
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
# Install senzing_governor.py.
RUN curl -X GET \
--output /opt/senzing/g2/sdk/python/senzing_governor.py \
https://raw.githubusercontent.com/Senzing/governor-postgresql-transaction-id/main/senzing_governor.py
# -----------------------------------------------------------------------------
# Stage: Final
# -----------------------------------------------------------------------------
# Create the runtime image.
FROM ${BASE_IMAGE} AS runner
ENV REFRESHED_AT=2024-06-24
LABEL Name="senzing/stream-loader" \
Maintainer="[email protected]" \
Version="2.2.13"
# Define health check.
HEALTHCHECK CMD ["/app/healthcheck.sh"]
# Run as "root" for system installation.
USER root
# Install packages via apt-get.
RUN apt-get update \
&& apt-get -y install \
libaio1 \
libodbc1 \
librdkafka-dev \
libxml2 \
postgresql-client \
python3 \
python3-venv \
unixodbc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy files from repository.
COPY ./rootfs /
COPY ./stream-loader.py /app/
# Copy python virtual environment from the builder image.
COPY --from=builder /app/venv /app/venv
COPY --from=builder /opt/senzing/g2/sdk/python/senzing_governor.py /opt/senzing/g2/sdk/python/senzing_governor.py
# Make non-root container.
USER 1001
# Activate virtual environment.
ENV VIRTUAL_ENV=/app/venv
ENV PATH="/app/venv/bin:${PATH}"
# Runtime environment variables.
ENV LD_LIBRARY_PATH=/opt/senzing/g2/lib:/opt/senzing/g2/lib/debian:/opt/IBM/db2/clidriver/lib
ENV PATH=${PATH}:/opt/senzing/g2/python:/opt/IBM/db2/clidriver/adm:/opt/IBM/db2/clidriver/bin
ENV PYTHONPATH=/opt/senzing/g2/sdk/python
ENV PYTHONUNBUFFERED=1
ENV SENZING_DOCKER_LAUNCHED=true
# Runtime execution.
WORKDIR /app
ENTRYPOINT ["/app/stream-loader.py"]