forked from behance/docker-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-centos
43 lines (37 loc) · 2.08 KB
/
Dockerfile-centos
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
FROM centos:7
LABEL Maintainer="Bryan Latten <[email protected]>"
# Use in multi-phase builds, when an init process requests for the container to gracefully exit, so that it may be committed
# Used with alternative CMD (worker.sh), leverages supervisor to maintain long-running processes
ENV SIGNAL_BUILD_STOP=99 \
S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \
S6_KILL_FINISH_MAXTIME=5000 \
S6_KILL_GRACETIME=3000 \
S6_VERSION=v1.21.7.0 \
S6_SHA256=7ffd83ad59d00d4c92d594f9c1649faa99c0b87367b920787d185f8335cbac47 \
GOSS_VERSION=v0.3.6 \
GOSS_SHA256=53dd1156ab66f2c4275fd847372e6329d895cfb2f0bcbec5f86c1c4df7236dde
# Ensure scripts are available for use in next command
COPY ./container/root/scripts/* /scripts/
# - Symlink variant-specific scripts to default location
# - Upgrade base security packages, then clean packaging leftover
# - Add S6 for zombie reaping, boot-time coordination, signal transformation/distribution: @see https://github.com/just-containers/s6-overlay#known-issues-and-workarounds
# - Add goss for local, serverspec-like testing
RUN ln -s /scripts/clean_centos.sh /clean.sh && \
ln -s /scripts/security_updates_centos.sh /security_updates.sh && \
/bin/bash -e /security_updates.sh && \
rpm -e systemd --nodeps && \
/bin/bash -e /clean.sh && \
curl -L https://github.com/just-containers/s6-overlay/releases/download/${S6_VERSION}/s6-overlay-amd64.tar.gz -o /tmp/s6.tar.gz && \
echo "${S6_SHA256} /tmp/s6.tar.gz" | sha256sum -c - && \
tar xzf /tmp/s6.tar.gz -C / --exclude="./bin" && \
tar xzf /tmp/s6.tar.gz -C /usr ./bin && \
rm -f /tmp/s6.tar.gz && \
curl -L https://github.com/aelsabbahy/goss/releases/download/${GOSS_VERSION}/goss-linux-amd64 -o /usr/local/bin/goss && \
echo "${GOSS_SHA256} /usr/local/bin/goss" | sha256sum -c - && \
chmod +x /usr/local/bin/goss
# Overlay the root filesystem from this repo
COPY ./container/root /
RUN goss -g goss.base.yaml validate
# NOTE: intentionally NOT using s6 init as the entrypoint
# This would prevent container debugging if any of those service crash
CMD ["/bin/bash", "/run.sh"]