github.com/openshift/source-to-image@v1.4.1-0.20240516041539-bf52fc02204e/examples/nginx-centos7/Dockerfile (about) 1 2 # nginx-centos7 3 # Here you can use whatever base image is relevant for your application. 4 FROM centos:centos7 5 6 # Here you can specify the maintainer for the image that you're building 7 LABEL maintainer="Your Name <your.name@example.com>" 8 9 # Export an environment variable that provides information about the application version. 10 # Replace this with the version for your application. 11 ENV NGINX_VERSION=1.6.3 12 13 # Set the labels that are used for OpenShift to describe the builder image. 14 LABEL io.k8s.description="Nginx Webserver" \ 15 io.k8s.display-name="Nginx 1.6.3" \ 16 io.openshift.expose-services="8080:http" \ 17 io.openshift.tags="builder,webserver,html,nginx" \ 18 # this label tells s2i where to find its mandatory scripts 19 # (run, assemble, save-artifacts) 20 io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" 21 22 # Install the nginx web server package and clean the yum cache 23 RUN yum install -y epel-release && \ 24 yum install -y --setopt=tsflags=nodocs nginx && \ 25 yum clean all 26 27 # Change the default port for nginx 28 # Required if you plan on running images as a non-root user). 29 RUN sed -i 's/80/8080/' /etc/nginx/nginx.conf 30 RUN sed -i 's/user nginx;//' /etc/nginx/nginx.conf 31 32 # Copy the S2I scripts to /usr/libexec/s2i since we set the label that way 33 COPY ./s2i/bin/ /usr/libexec/s2i 34 35 RUN chown -R 1001:1001 /usr/share/nginx 36 RUN chown -R 1001:1001 /var/log/nginx 37 RUN chown -R 1001:1001 /var/lib/nginx 38 RUN touch /run/nginx.pid 39 RUN chown -R 1001:1001 /run/nginx.pid 40 RUN chown -R 1001:1001 /etc/nginx 41 42 USER 1001 43 44 # Set the default port for applications built using this image 45 EXPOSE 8080 46 47 # Modify the usage script in your application dir to inform the user how to run 48 # this image. 49 CMD ["/usr/libexec/s2i/usage"]