1
0
mirror of https://github.com/openshift/source-to-image.git synced 2026-02-05 12:44:54 +01:00
Files
source-to-image/examples/nginx-centos7/Dockerfile

50 lines
1.7 KiB
Docker

# nginx-centos7
# Here you can use whatever base image is relevant for your application.
FROM centos:centos7
# Here you can specify the maintainer for the image that you're building
LABEL maintainer="Your Name <your.name@example.com>"
# Export an environment variable that provides information about the application version.
# Replace this with the version for your application.
ENV NGINX_VERSION=1.6.3
# Set the labels that are used for OpenShift to describe the builder image.
LABEL io.k8s.description="Nginx Webserver" \
io.k8s.display-name="Nginx 1.6.3" \
io.openshift.expose-services="8080:http" \
io.openshift.tags="builder,webserver,html,nginx" \
# this label tells s2i where to find its mandatory scripts
# (run, assemble, save-artifacts)
io.openshift.s2i.scripts-url="image:///usr/libexec/s2i"
# Install the nginx web server package and clean the yum cache
RUN yum install -y epel-release && \
yum install -y --setopt=tsflags=nodocs nginx && \
yum clean all
# Change the default port for nginx
# Required if you plan on running images as a non-root user).
RUN sed -i 's/80/8080/' /etc/nginx/nginx.conf
RUN sed -i 's/user nginx;//' /etc/nginx/nginx.conf
# Copy the S2I scripts to /usr/libexec/s2i since we set the label that way
COPY ./s2i/bin/ /usr/libexec/s2i
RUN chown -R 1001:1001 /usr/share/nginx
RUN chown -R 1001:1001 /var/log/nginx
RUN chown -R 1001:1001 /var/lib/nginx
RUN touch /run/nginx.pid
RUN chown -R 1001:1001 /run/nginx.pid
RUN chown -R 1001:1001 /etc/nginx
USER 1001
# Set the default port for applications built using this image
EXPOSE 8080
# Modify the usage script in your application dir to inform the user how to run
# this image.
CMD ["/usr/libexec/s2i/usage"]