Updated nginx on almalinux
Build and push Nginx on almalinux based container images / Build nginx container images (1.22) (push) Successful in 3m26s Details
Build and push Nginx on almalinux based container images / Build nginx container images (1.24) (push) Successful in 2m50s Details

This commit is contained in:
Muhamad Aditya Prima 2024-12-18 01:37:53 +07:00
parent 98222c5e2f
commit 52643aaea3
2 changed files with 52 additions and 47 deletions

View File

@ -44,32 +44,32 @@ jobs:
# image-ref: 'quay.io/sindigilive/nginx:${{ matrix.version }}-almalinux' # image-ref: 'quay.io/sindigilive/nginx:${{ matrix.version }}-almalinux'
# format: 'sarif' # format: 'sarif'
# output: 'trivy-results.sarif' # output: 'trivy-results.sarif'
build-latest: # build-latest:
name: Build latest nginx almalinux based container images # name: Build latest nginx almalinux based container images
runs-on: ubuntu-latest # runs-on: ubuntu-latest
needs: # needs:
- build # - build
container: # container:
image: ghcr.io/catthehacker/ubuntu:act-latest # image: ghcr.io/catthehacker/ubuntu:act-latest
steps: # steps:
- name: Check out repository code # - name: Check out repository code
uses: actions/checkout@v4 # uses: actions/checkout@v4
- name: Login to quay.io # - name: Login to quay.io
uses: docker/login-action@v3 # uses: docker/login-action@v3
with: # with:
registry: quay.io # registry: quay.io
username: ${{ vars.QUAY_USERNAME }} # username: ${{ vars.QUAY_USERNAME }}
password: ${{ secrets.QUAY_SECRET }} # password: ${{ secrets.QUAY_SECRET }}
# - name: Set up QEMU # # - name: Set up QEMU
# uses: docker/setup-qemu-action@v3 # # uses: docker/setup-qemu-action@v3
- name: Setup Docker buildx # - name: Setup Docker buildx
uses: docker/setup-buildx-action@v3 # uses: docker/setup-buildx-action@v3
- name: Build and push latest nginx # - name: Build and push latest nginx
uses: docker/build-push-action@v5 # uses: docker/build-push-action@v5
with: # with:
# platforms: linux/amd64,linux/arm64 # # platforms: linux/amd64,linux/arm64
push: true # push: true
context: . # context: .
file: Dockerfile.almalinux # file: Dockerfile.almalinux
tags: | # tags: |
quay.io/sindigilive/nginx:almalinux # quay.io/sindigilive/nginx:almalinux

View File

@ -1,24 +1,28 @@
ARG ALMALINUX_VERSION=9.5 ARG OS_VERSION=9.5
FROM quay.io/sindigilive/almalinux:${ALMALINUX_VERSION} AS builder FROM quay.io/sindigilive/almalinux:${OS_VERSION} AS builder
ARG NGINX_VERSION=1.24 ARG NGINX_VERSION=1.24
RUN mkdir -p /mnt/rootfs; \ ENV ROOTFS=/mnt/rootfs
dnf install --installroot /mnt/rootfs \
RUN mkdir -p ${ROOTFS}; \
dnf install --installroot ${ROOTFS} \
coreutils-single \ coreutils-single \
glibc-minimal-langpack \ glibc-minimal-langpack \
--releasever 9 --setopt install_weak_deps=false --nodocs -y; \ --releasever 9 --setopt install_weak_deps=false --nodocs --nogpgcheck -y; \
dnf module reset nginx ; \ dnf module reset nginx ; \
dnf module enable nginx:${NGINX_VERSION} ; \ dnf module enable nginx:${NGINX_VERSION} ; \
dnf install --installroot /mnt/rootfs \ dnf install --installroot ${ROOTFS} \
nginx \ nginx \
--releasever 9 --setopt install_weak_deps=false --nodocs -y; \ --releasever 9 --setopt install_weak_deps=false --nodocs --nogpgcheck -y; \
dnf --installroot /mnt/rootfs clean all; dnf --installroot ${ROOTFS} clean all;
FROM quay.io/sindigilive/almalinux:${ALMALINUX_VERSION}-micro AS stage2 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 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 htdocs /app/htdocs
ADD scripts/entrypoint.sh /usr/local/bin/ ADD scripts/entrypoint.sh /usr/local/bin/
@ -31,17 +35,18 @@ RUN echo "nginx:x:10001:" >> /etc/group ; \
chmod +x /usr/local/bin/entrypoint.sh chmod +x /usr/local/bin/entrypoint.sh
COPY --from=builder \ COPY --from=builder \
/usr/lib64/libc* \ ${SRC}/libcrypt.so.2 ${SRC}/libpcre.so.1 ${SRC}/libssl.so.3 \
/usr/lib64/libcrypt* \ ${SRC}/libcrypto.so.3 ${SRC}/libz.so.1 \
/usr/lib64/libcrypto* \ # /usr/lib64/libcrypt* \
/usr/lib64/libpcre* \ # /usr/lib64/libcrypto* \
/usr/lib64/libssl* \ # /usr/lib64/libpcre* \
/usr/lib64/libz* \ # /usr/lib64/libssl* \
# /usr/lib64/libz* \
/usr/lib64/ /usr/lib64/
COPY --from=builder /mnt/rootfs/etc/nginx /etc/nginx COPY --from=builder ${ROOTFS}/etc/nginx /etc/nginx
COPY --from=builder /mnt/rootfs/usr/lib64/nginx /usr/lib64/nginx COPY --from=builder ${ROOTFS}/usr/lib64/nginx /usr/lib64/nginx
COPY --from=builder /mnt/rootfs/usr/sbin/nginx /usr/sbin/nginx COPY --from=builder ${ROOTFS}/usr/sbin/nginx /usr/sbin/nginx
ADD etc/nginx /etc/nginx ADD etc/nginx /etc/nginx