-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
152 lines (108 loc) · 3.24 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
ARG BASE_IMAGE=senzing/senzingapi-tools:3.12.5
ARG IMAGE_NAME="senzing/sshd"
ARG IMAGE_MAINTAINER="support@senzing.com"
ARG IMAGE_VERSION="1.5.0"
# -----------------------------------------------------------------------------
# Stage: builder
# -----------------------------------------------------------------------------
FROM ${BASE_IMAGE} AS builder
# Set Shell to use for RUN commands in builder step.
ENV REFRESHED_AT=2025-03-06
# Run as "root" for system installation.
USER root
# Install packages via apt for building fio.
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get -y install \
gcc \
make \
pkg-config \
python3 \
python3-dev \
python3-pip \
python3-venv \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/*
# Work around until Debian repos catch up to modern versions of fio.
RUN mkdir /tmp/fio \
&& cd /tmp/fio \
&& wget https://github.com/axboe/fio/archive/refs/tags/fio-3.39.zip \
&& unzip fio-3.39.zip \
&& cd fio-fio-3.39/ \
&& ./configure \
&& make \
&& make install \
&& fio --version \
&& cd \
&& rm -rf /tmp/fio
# Create and activate virtual environment.
RUN python3 -m venv /app/venv
ENV PATH="/app/venv/bin:$PATH"
# pip install Python dependencies.
COPY requirements.txt .
RUN pip3 install --upgrade pip \
&& pip3 install -r requirements.txt \
&& rm /requirements.txt
# -----------------------------------------------------------------------------
# Stage: Final
# -----------------------------------------------------------------------------
# Create the runtime image.
FROM ${BASE_IMAGE} AS runner
ARG IMAGE_NAME
ARG IMAGE_MAINTAINER
ARG IMAGE_VERSION
LABEL Name=${IMAGE_NAME} \
Maintainer=${IMAGE_MAINTAINER} \
Version=${IMAGE_VERSION}
# Define health check.
HEALTHCHECK CMD ["/app/healthcheck.sh"]
# Run as "root" for system installation.
USER root
# Install packages via apt.
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get -y install \
elvis-tiny \
htop \
iotop \
jq \
net-tools \
openssh-server \
postgresql-common \
procps \
python3-dev \
python3-pip \
python3-pyodbc \
strace \
tree \
unzip \
wget \
zip \
&& /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y \
&& apt-get -y install postgresql-client-14 \
&& rm -rf /var/lib/apt/lists/*
# Copy python virtual environment from the builder image.
COPY --from=builder /app/venv /app/venv
# Activate virtual environment.
ENV VIRTUAL_ENV=/app/venv
ENV PATH="/app/venv/bin:${PATH}"
# Configure sshd.
RUN mkdir /var/run/sshd \
&& sed -i -e '$aPermitRootLogin yes' /etc/ssh/sshd_config \
&& sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
# Copy files from repository.
COPY ./rootfs /
RUN /app/update-motd.sh \
&& /app/update-etc-profile.sh
# Copy files from prior stages.
COPY --from=builder "/usr/local/bin/fio" "/usr/local/bin/fio"
# The port for ssh is 22.
EXPOSE 22
# Runtime environment variables.
ENV NOTVISIBLE="in users profile" \
ROOT_PASSWORD=senzingsshdpassword \
SENZING_ETC_PATH=/etc/opt/senzing \
SENZING_SSHD_SHOW_PERFORMANCE_WARNING=true
# Runtime execution.
CMD ["/app/docker-entrypoint.sh"]