2020-12-26 13:11:49 +00:00
|
|
|
# Runtime layer
|
2021-01-27 09:23:29 +00:00
|
|
|
FROM alpine:3.13
|
2020-04-01 02:08:21 +00:00
|
|
|
|
2020-06-15 10:04:08 +00:00
|
|
|
# Create appuser and group.
|
2020-04-01 02:08:21 +00:00
|
|
|
ARG USER=inetmock
|
2020-06-15 10:04:08 +00:00
|
|
|
ARG GROUP=inetmock
|
2020-04-01 02:08:21 +00:00
|
|
|
ARG USER_ID=10001
|
2020-06-15 10:04:08 +00:00
|
|
|
ARG GROUP_ID=10001
|
2020-04-01 02:08:21 +00:00
|
|
|
|
2020-12-26 13:11:49 +00:00
|
|
|
RUN addgroup -S -g "${GROUP_ID}" "${GROUP}" && \
|
2020-04-01 02:08:21 +00:00
|
|
|
adduser \
|
|
|
|
--disabled-password \
|
|
|
|
--gecos "" \
|
|
|
|
--home "/nonexistent" \
|
|
|
|
--shell "/sbin/nologin" \
|
|
|
|
--no-create-home \
|
2020-06-15 10:04:08 +00:00
|
|
|
-G "${GROUP}" \
|
2020-04-01 02:08:21 +00:00
|
|
|
--uid "${USER_ID}" \
|
|
|
|
"${USER}"
|
|
|
|
|
2020-12-26 13:11:49 +00:00
|
|
|
COPY --chown=$USER:$GROUP inetmock imctl /usr/lib/inetmock/bin/
|
|
|
|
COPY --chown=$USER:$GROUP assets/fakeFiles /var/lib/inetmock/fakeFiles/
|
2021-01-27 09:23:29 +00:00
|
|
|
COPY --chown=$USER:$GROUP assets/demoCA /var/lib/inetmock/ca
|
2020-06-15 10:04:08 +00:00
|
|
|
COPY config-container.yaml /etc/inetmock/config.yaml
|
|
|
|
|
|
|
|
RUN mkdir -p /var/run/inetmock /var/lib/inetmock/certs /usr/lib/inetmock && \
|
2020-06-15 11:01:37 +00:00
|
|
|
chown -R $USER:$GROUP /var/run/inetmock /var/lib/inetmock /usr/lib/inetmock && \
|
|
|
|
apk add -U --no-cache libcap
|
2020-04-01 22:58:44 +00:00
|
|
|
|
2020-06-15 10:04:08 +00:00
|
|
|
RUN ln -s /usr/lib/inetmock/bin/inetmock /usr/bin/inetmock && \
|
2020-06-15 11:01:37 +00:00
|
|
|
ln -s /usr/lib/inetmock/bin/imctl /usr/bin/imctl && \
|
|
|
|
setcap 'cap_net_bind_service=+ep' /usr/lib/inetmock/bin/inetmock
|
|
|
|
|
|
|
|
HEALTHCHECK --interval=5s --timeout=1s \
|
|
|
|
CMD imctl --socket-path /var/run/inetmock/inetmock.sock health container
|
2020-04-01 02:08:21 +00:00
|
|
|
|
2020-06-15 10:04:08 +00:00
|
|
|
USER $USER
|
2020-04-01 02:08:21 +00:00
|
|
|
|
2020-06-15 10:04:08 +00:00
|
|
|
VOLUME [ "/var/lib/inetmock/ca", "/var/lib/inetmock/certs" ]
|
2020-04-01 02:08:21 +00:00
|
|
|
|
2020-06-15 10:04:08 +00:00
|
|
|
ENTRYPOINT ["inetmock"]
|