cverna / container / nginx

Forked from container/nginx 5 years ago
Clone

Blame Dockerfile

a6ce591
FROM registry.fedoraproject.org/f28/s2i-base:latest
18c49f3
18c49f3
# nginx 1.12 image.
18c49f3
#
18c49f3
# Volumes:
18c49f3
#  * /var/log/nginx/ - Storage for logs
18c49f3
18c49f3
EXPOSE 8080
18c49f3
EXPOSE 8443
18c49f3
18c49f3
ENV NAME=nginx \
18c49f3
    NGINX_VERSION=1.12 \
18c49f3
    VERSION=0 \
18c49f3
    ARCH=x86_64
18c49f3
18c49f3
ENV SUMMARY="Platform for running nginx $NGINX_VERSION or building nginx-based application" \
18c49f3
    DESCRIPTION="Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP \
18c49f3
protocols, with a strong focus on high concurrency, performance and low memory usage. The container \
18c49f3
image provides a containerized packaging of the nginx $NGINX_VERSION daemon. The image can be used \
18c49f3
as a base image for other applications based on nginx $NGINX_VERSION web server. \
18c49f3
Nginx server image can be extended using source-to-image tool."
18c49f3
18c49f3
LABEL summary="$SUMMARY" \
18c49f3
      description="$DESCRIPTION" \
18c49f3
      io.k8s.description="$SUMMARY" \
18c49f3
      io.k8s.display-name="Nginx $NGINX_VERSION" \
18c49f3
      io.openshift.expose-services="8080:http" \
18c49f3
      io.openshift.expose-services="8443:https" \
18c49f3
      io.openshift.tags="builder,nginx,nginx112" \
18c49f3
      com.redhat.component="$NAME" \
18c49f3
      name="$FGC/$NAME" \
18c49f3
      version="$VERSION" \
18c49f3
      architecture="$ARCH" \
18c49f3
      usage="s2i build file:///your/app $FGC/nginx your-app"
18c49f3
18c49f3
ENV NGINX_CONFIGURATION_PATH=/opt/app-root/etc/nginx.d
18c49f3
ENV NGINX_DEFAULT_CONF_PATH=/opt/app-root/etc/nginx.default.d
18c49f3
18c49f3
RUN dnf install -y gettext hostname && \
18c49f3
    INSTALL_PKGS="nss_wrapper bind-utils nginx" && \
18c49f3
    dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
18c49f3
    rpm -V $INSTALL_PKGS && \
18c49f3
    dnf clean all
18c49f3
18c49f3
# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH
18c49f3
COPY ./s2i/bin/ $STI_SCRIPTS_PATH
18c49f3
18c49f3
# Copy extra files to the image.
18c49f3
COPY ./root/ /
18c49f3
18c49f3
# In order to drop the root user, we have to make some directories world
18c49f3
# writeable as OpenShift default security model is to run the container under
18c49f3
# random UID.
18c49f3
RUN sed -i -f /opt/app-root/nginxconf-fed.sed /etc/nginx/nginx.conf && \
18c49f3
    mkdir -p /opt/app-root/etc/nginx.d/ && \
18c49f3
    mkdir -p /opt/app-root/etc/nginx.default.d/ && \
18c49f3
    chmod -R a+rwx /opt/app-root/etc && \
18c49f3
    chmod -R a+rwx /var /run && \
18c49f3
    chown -R 1001:0 /opt/app-root && \
18c49f3
    chown -R 1001:0 /var
18c49f3
18c49f3
USER 1001
18c49f3
18c49f3
VOLUME ["/usr/share/nginx/html"]
18c49f3
VOLUME ["/var/log/nginx/"]
18c49f3
18c49f3
CMD $STI_SCRIPTS_PATH/usage