77 lines
2.2 KiB
Docker
77 lines
2.2 KiB
Docker
ARG OS_VERSION=9.5
|
|
|
|
FROM quay.io/sindigilive/almalinux:${OS_VERSION} AS builder
|
|
|
|
ARG NGINX_VERSION=1.24
|
|
|
|
ENV ROOTFS=/mnt/rootfs
|
|
|
|
RUN mkdir -p ${ROOTFS}; \
|
|
dnf install --installroot ${ROOTFS} \
|
|
coreutils-single \
|
|
glibc-minimal-langpack \
|
|
--releasever 9 --setopt install_weak_deps=false --nodocs --nogpgcheck -y; \
|
|
dnf module reset nginx ; \
|
|
dnf module enable nginx:${NGINX_VERSION} ; \
|
|
dnf install --installroot ${ROOTFS} \
|
|
nginx \
|
|
--releasever 9 --setopt install_weak_deps=false --nodocs --nogpgcheck -y; \
|
|
dnf --installroot ${ROOTFS} clean all;
|
|
|
|
FROM quay.io/sindigilive/almalinux:${OS_VERSION}-micro AS stage2
|
|
|
|
ENV DIR_DEPS="/var/run/nginx /var/log/nginx /var/lib/nginx/tmp /var/cache/nginx"
|
|
ENV ROOTFS=/mnt/rootfs
|
|
ENV SRC=${ROOTFS}/usr/lib64
|
|
|
|
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 \
|
|
${SRC}/libcrypt.so.2 ${SRC}/libpcre.so.1 ${SRC}/libssl.so.3 \
|
|
${SRC}/libcrypto.so.3 ${SRC}/libz.so.1 \
|
|
# /usr/lib64/libcrypt* \
|
|
# /usr/lib64/libcrypto* \
|
|
# /usr/lib64/libpcre* \
|
|
# /usr/lib64/libssl* \
|
|
# /usr/lib64/libz* \
|
|
/usr/lib64/
|
|
|
|
COPY --from=builder ${ROOTFS}/etc/nginx /etc/nginx
|
|
COPY --from=builder ${ROOTFS}/usr/lib64/nginx /usr/lib64/nginx
|
|
COPY --from=builder ${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"] |