1
- FROM ubuntu:14.04
1
+ FROM behance/docker-base:1.3
2
2
MAINTAINER Bryan Latten <
[email protected] >
3
3
4
- # Use in multi-phase builds, when an init process requests for the container to gracefully exit, so that it may be committed
5
- # Used with alternative CMD (worker.sh), leverages supervisor to maintain long-running processes
6
- ENV SIGNAL_BUILD_STOP=99 \
7
- CONTAINER_ROLE=web \
4
+ ENV CONTAINER_ROLE=web \
8
5
CONTAINER_PORT=8080 \
9
6
CONF_NGINX_SITE="/etc/nginx/sites-available/default" \
10
7
CONF_NGINX_SERVER="/etc/nginx/nginx.conf" \
11
- NOT_ROOT_USER=www-data \
12
- S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \
13
- S6_KILL_FINISH_MAXTIME=5000 \
14
- S6_KILL_GRACETIME=3000
8
+ NOT_ROOT_USER=www-data
9
+
10
+ # Using a non-privileged port to prevent having to use setcap internally
11
+ EXPOSE ${CONTAINER_PORT}
15
12
16
13
# Ensure base system is up to date
17
14
RUN apt-get update && \
18
15
apt-get upgrade -yqq && \
19
16
# Install pre-reqs \
20
17
apt-get install -yqq \
21
18
software-properties-common \
22
- curl \
23
19
&& \
24
- # Add goss for local testing
25
- curl -L https://github.com/aelsabbahy/goss/releases/download/v0.2.3/goss-linux-amd64 -o /usr/local/bin/goss && \
26
- chmod +x /usr/local/bin/goss && \
27
- apt-get remove --purge -yq curl && \
28
20
# Install latest nginx (development PPA is actually mainline development) \
29
21
add-apt-repository ppa:nginx/development -y && \
30
22
apt-get update -yqq && \
@@ -39,27 +31,24 @@ RUN apt-get update && \
39
31
make \
40
32
unattended-upgrades \
41
33
python* \
42
- && \
34
+ && \
43
35
apt-get autoclean -y && \
44
36
apt-get autoremove -y && \
45
37
rm -rf /var/lib/{cache,log}/ && \
46
- rm -rf /var/lib/apt/lists/ && \
47
- rm -rf /tmp/* /var/tmp/*
38
+ rm -rf /tmp/* /var/tmp/* && \
39
+ rm -rf /var/lib/apt/lists/*.lz4
48
40
49
41
# Overlay the root filesystem from this repo
50
42
COPY ./container/root /
51
43
52
- # Add S6 overlay build, to avoid having to build from source
53
- RUN tar xzf /tmp/s6-overlay-amd64.tar.gz -C / && \
54
- rm /tmp/s6-overlay-amd64.tar.gz && \
55
- # Set nginx to listen on defined port \
56
- sed -i "s/listen [0-9]*;/listen ${CONTAINER_PORT};/" $CONF_NGINX_SITE
44
+ # Set nginx to listen on defined port
45
+ # NOTE: order of operations is important, new config had to already installed from repo (above)
46
+ RUN sed -i "s/listen [0-9]*;/listen ${CONTAINER_PORT};/" $CONF_NGINX_SITE && \
47
+ # Make temp directory for .nginx runtime files \
48
+ mkdir /tmp/.nginx
57
49
58
- RUN goss -g goss.nginx.yaml validate && \
59
- /tmp/aufs_hack.sh
60
-
61
- # Using a non-privileged port to prevent having to use setcap internally
62
- EXPOSE ${CONTAINER_PORT}
50
+ RUN goss -g /tests/nginx/base.goss.yaml validate && \
51
+ /aufs_hack.sh
63
52
64
53
# NOTE: intentionally NOT using s6 init as the entrypoint
65
54
# This would prevent container debugging if any of those service crash
0 commit comments