diff --git a/README.md b/README.md index 9f8dead..3b60412 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ -This is a Dockerfile and build bash script for the OFFICIAL NGINX ORG Distribution. +This is a Dockerfile and a bash build script for the OFFICIAL NGINX ORG Distribution. + This can be used as it is for deploying NGINX to a Docker or Openshift environment, or as base image for applications. + It is based on CENTOS - 7 at the time i write this - but it should be quite simple to convert for Debian derivates. + This image exposes only port 8080 and 8443 - eventhough the bare server is bound only to 8080 and HTTP - but it would quite easy to start the image binding /etc/nginx and a for example /opt/wwwroot to host provided volumes containing a persistent configuration and web content. The image is meant to run NGINX using a NON-ROOT user, per default UID 9001 is used, but you can change to another UID at build time. Keep in mind that the NGINX user needs access to the host volumes , should you mount content. diff --git a/stable/amd64/centos/Dockerfile b/stable/amd64/centos/Dockerfile index 7e5d820..495a500 100644 --- a/stable/amd64/centos/Dockerfile +++ b/stable/amd64/centos/Dockerfile @@ -7,35 +7,11 @@ FROM centos:7 # Build Time Arguments # ARG NAME -ARG NGINX_VERSION +ARG NGINX_VERSION ARG NGINX_REPO ARG NGINX_SHORT_REPO -ARG NGINX_SVC_NAME -ARG NGINX_SVC_UID - - -# -# Do some bookeeping -# -ENV SUMMARY="Platform for running nginx $NGINX_VERSION-$NGINX_SHORT_REPO or building nginx-based application" \ - DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \ -protocols, with a strong focus on high concurrency, performance and low memory usage. The container \ -image provides a containerized packaging of the nginx $NGINX_VERSION-$NGINX_SHORT_REPO daemon. The image can be used \ -as a base image for other applications based on nginx $NGINX_VERSION-$NGINX_SHORT_REPO web server. \ -Nginx server image can be extended using source-to-image tool." - -LABEL summary="${SUMMARY}" \ - description="${DESCRIPTION}" \ - io.k8s.description="${DESCRIPTION}" \ - io.k8s.display-name="NGINX ${NGINX_SHORT_REPO}-${NGINX_VERSION}" \ - io.openshift.expose-services="8080:http" \ - io.openshift.expose-services="8443:https" \ - io.openshift.tags="builder,${NAME},${NAME}-$NGINX_SHORT_REPO-${NGINX_VER}" \ - name="${NAME}" \ - version="${NGINX_VERSION}-amd64-centos" \ - maintainer="ignidis" \ - help="For more information visit https://github.com/ignidis" \ - usage="s2i build ${NAME}:${NGINX_VERSION}-amd64-centos " +ARG NGINX_SVC_NAME +ARG NGINX_SVC_UID # # Add NGINX official repositories @@ -100,6 +76,46 @@ RUN yum install -y yum-utils; \ ln -sf /dev/stdout /var/log/nginx/access.log; \ ln -sf /dev/stderr /var/log/nginx/error.log +# +# Compress the images +# +FROM scratch +COPY --from=0 / / + +# +# Build Time Arguments +# +ARG NAME +ARG NGINX_VERSION +ARG NGINX_REPO +ARG NGINX_SHORT_REPO +ARG NGINX_SVC_NAME +ARG NGINX_SVC_UID + +# +# Do some bookeeping for the repository and openshift +# +# +# It is deprecated but guess what...There are a lot of tools that still use it +# +MAINTAINER ignidis(at)cybearth(dot)net (https://github.com/ignidis/nginx-docker) + +# +# And this is for those new tools +# +LABEL summary="Platform for running ${NAME}-${NGINX_SHORT_REPO}-${NGINX_VERSION} or building ${NAME}-based applications" \ + description="${NAME} is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP protocols, with a strong focus on high concurrency, performance and low memory usage. The container image provides a containerized packaging of the ${NAME}-${NGINX_SHORT_REPO}-$NGINX_VERSION daemon. The image can be used as a base image for other applications based on the ${NAME} web server. The ${NAME} server image can be extended using a source-to-image tool." \ + io.k8s.description="${NAME} is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP protocols, with a strong focus on high concurrency, performance and low memory usage. The container image provides a containerized packaging of the ${NAME}-${NGINX_SHORT_REPO}-$NGINX_VERSION daemon. The image can be used as a base image for other applications based on the ${NAME} web server. The ${NAME} server image can be extended using a source-to-image tool." \ + io.k8s.display-name="NGINX-${NGINX_SHORT_REPO}-${NGINX_VERSION}" \ + io.openshift.expose-services="8080:http" \ + io.openshift.expose-services="8443:https" \ + io.openshift.tags="builder,${NAME},${NAME}-${NGINX_SHORT_REPO}-${NGINX_VERSION}" \ + name="${NAME}" \ + version="${NGINX_VERSION}-amd64-centos" \ + maintainer="ignidis(at)cybearth(dot)net" \ + help="For more information visit https://github.com/ignidis/nginx-docker" \ + usage="s2i build ${NAME}:${NGINX_VERSION}-amd64-centos " + # # Publish the standard web ports # @@ -109,4 +125,4 @@ STOPSIGNAL SIGTERM USER ${NGINX_SVC_UID} -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +CMD ["nginx", "-g", "daemon off;"] diff --git a/stable/amd64/centos/build.sh b/stable/amd64/centos/build.sh index 5d45d2c..1316b28 100644 --- a/stable/amd64/centos/build.sh +++ b/stable/amd64/centos/build.sh @@ -6,4 +6,4 @@ # # Must run as superuser, either you are root or must sudo # -docker build --build-arg NAME="nginx" --build-arg NGINX_VERSION="$1" --build-arg NGINX_REPO="nginx-stable" --build-arg NGINX_SHORT_REPO="stable" --build-arg NGINX_SVC_NAME="nginx" --build-arg NGINX_SVC_UID="9001" -t nginx:"$1"-amd64-centos . +docker build --build-arg NAME="NGINX" --build-arg NGINX_VERSION="$1" --build-arg NGINX_REPO="nginx-stable" --build-arg NGINX_SHORT_REPO="stable" --build-arg NGINX_SVC_NAME="nginx" --build-arg NGINX_SVC_UID="9001" -t nginx:"$1"-amd64-centos .