nginx/Dockerfile.almalinux

72 lines
2.1 KiB
Docker

ARG ALMALINUX_VERSION=9.5
FROM quay.io/sindigilive/almalinux:${ALMALINUX_VERSION} AS builder
ARG NGINX_VERSION=1.24
RUN mkdir -p /mnt/rootfs; \
dnf install --installroot /mnt/rootfs \
coreutils-single \
glibc-minimal-langpack \
--releasever 9 --setopt install_weak_deps=false --nodocs -y; \
dnf module reset nginx ; \
dnf module enable nginx:${NGINX_VERSION} ; \
dnf install --installroot /mnt/rootfs \
nginx \
--releasever 9 --setopt install_weak_deps=false --nodocs -y; \
dnf --installroot /mnt/rootfs clean all;
FROM quay.io/sindigilive/almalinux:${ALMALINUX_VERSION}-micro AS stage2
ENV DIR_DEPS="/var/run/nginx /var/log/nginx /var/lib/nginx/tmp /var/cache/nginx"
ADD htdocs /app/htdocs
ADD scripts/entrypoint.sh /usr/local/bin/
RUN echo "nginx:x:10001:" >> /etc/group ; \
echo "nginx:x:10001:10001:nginx:/app/htdocs:/sbin/nologin" >> /etc/passwd ; \
echo "nginx:!!:20070::::::" >> /etc/shadow ; \
mkdir -p ${DIR_DEPS} ; \
chown -R nginx:nginx ${DIR_DEPS} ; \
chmod +x /usr/local/bin/entrypoint.sh
COPY --from=builder \
/usr/lib64/libc* \
/usr/lib64/libcrypt* \
/usr/lib64/libcrypto* \
/usr/lib64/libpcre* \
/usr/lib64/libssl* \
/usr/lib64/libz* \
/usr/lib64/
COPY --from=builder /mnt/rootfs/etc/nginx /etc/nginx
COPY --from=builder /mnt/rootfs/usr/lib64/nginx /usr/lib64/nginx
COPY --from=builder /mnt/rootfs/usr/sbin/nginx /usr/sbin/nginx
ADD etc/nginx /etc/nginx
FROM scratch
ARG NGINX_VERSION=1.24
ENV NGINX_VERSION=${NGINX_VERSION}
LABEL maintainer="Muhamad Aditya Prima <map@sindigilive.com>"
LABEL name="nginx"
LABEL version="${NGINX_VERSION}"
LABEL distribution-scope="public"
#labels for container catalog
LABEL summary="Nginx ${NGINX_VERSION} on almalinux based container image"
LABEL description="Provide nginx on almalinux based container base image"
LABEL io.k8s.description="Very small almalinux container image"
LABEL io.k8s.display-name="Nginx ${NGINX_VERSION}"
COPY --from=stage2 / /
USER nginx
EXPOSE 80
STOPSIGNAL SIGQUIT
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]