Skip to content

Commit

Permalink
Merge pull request #32 from bryanlatten/feature-port-env
Browse files Browse the repository at this point in the history
Dockerfile: added unprivileged port to ENV variables (as constant)
  • Loading branch information
bryanlatten committed Jun 1, 2016
2 parents c67eaef + a95da50 commit a475bc6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ MAINTAINER Bryan Latten <[email protected]>
# Used with alternative CMD (worker.sh), leverages supervisor to maintain long-running processes
ENV SIGNAL_BUILD_STOP=99 \
CONTAINER_ROLE=web \
CONTAINER_PORT=8080 \
CONF_NGINX_SITE="/etc/nginx/sites-available/default" \
CONF_NGINX_SERVER="/etc/nginx/nginx.conf" \
NOT_ROOT_USER=www-data \
S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \
S6_KILL_FINISH_MAXTIME=5000 \
S6_KILL_GRACETIME=3000


# Ensure base system is up to date
RUN apt-get update && \
apt-get upgrade -yqq && \
Expand Down Expand Up @@ -46,10 +46,12 @@ COPY ./container/root /

# Add S6 overlay build, to avoid having to build from source
RUN tar xzf /tmp/s6-overlay-amd64.tar.gz -C / && \
rm /tmp/s6-overlay-amd64.tar.gz
rm /tmp/s6-overlay-amd64.tar.gz && \
# Set nginx to listen on defined port \
sed -i "s/listen [0-9]*;/listen ${CONTAINER_PORT};/" $CONF_NGINX_SITE

# Using a non-privileged port to prevent having to use setcap internally
EXPOSE 8080
EXPOSE ${CONTAINER_PORT}

# NOTE: intentionally NOT using s6 init as the entrypoint
# This would prevent container debugging if any of those service crash
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# docker-nginx
Provides base OS, patches and stable nginx for quick and easy spinup.
Integrates S6 process supervisor for zombie reaping (as PID 1) and boot coordination.
Integrates S6 process supervisor `only` for zombie reaping (as PID 1), boot coordination, and termination signal translation


@see https://github.com/just-containers/s6-overlay

### Expectations
Expand All @@ -9,7 +11,6 @@ Applications using this as a container parent must copy their html/app into the
NOTE: Nginx is exposed and bound to an unprivileged port, `8080`



### Environment Variables

Variable | Example | Description
Expand Down

0 comments on commit a475bc6

Please sign in to comment.