Skip to content

Commit

Permalink
added 1.25 nginx tag
Browse files Browse the repository at this point in the history
  • Loading branch information
michealch committed Feb 1, 2024
1 parent 9e9fdd0 commit 6311254
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 10 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/1.25-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build and Push Docker Image

on:
schedule:
- cron: '0 2 * * *'
push:
branches:
- main

jobs:
build:
runs-on: self-hosted
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build Docker image (no push)
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile-1.25
tags: distrolessdevops/nginx-distroless:1.25

push:
runs-on: self-hosted
needs: build
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
steps:
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile-1.25
push: true
tags: distrolessdevops/nginx-distroless:1.25.3

- name: Logout from Docker Hub
run: docker logout
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ name: Build and Push Docker Image

on:
schedule:
# Runs at 00:00 UTC every Sunday
- cron: '0 0 * * 0'
pull_request:
branches:
- main
- cron: '0 3 * * *'
push:
branches:
- main
Expand All @@ -25,9 +21,8 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
load: true
tags: distrolessdevops/nginx-distroless:latest
file: ./Dockerfile-mainline
tags: distrolessdevops/nginx-distroless:latest

push:
runs-on: self-hosted
Expand All @@ -44,10 +39,9 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
file: ./Dockerfile-mainline
push: true
tags: distrolessdevops/nginx-distroless:latest

- name: Logout from Docker Hub
if: always()
run: docker logout
File renamed without changes.
33 changes: 33 additions & 0 deletions Dockerfile-mainline
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Use NGINX Unprivileged as the base image
FROM nginxinc/nginx-unprivileged:mainline-bookworm AS base

# Use distroless as the final base image
FROM gcr.io/distroless/base-debian12:nonroot AS final

# Copy NGINX binary and configuration files
COPY --from=base /usr/sbin/nginx /usr/sbin/nginx
COPY --from=base /etc/nginx /etc/nginx

# Copy NGINX HTML directory
COPY --from=base /usr/share/nginx/html /usr/share/nginx/html

# Copy NGINX cache and log directories with proper permissions
COPY --from=base --chmod=777 /var/cache/nginx /var/cache/nginx
COPY --from=base --chmod=777 /var/log/nginx /var/log/nginx

# Copy required shared libraries
COPY --from=base /lib/x86_64-linux-gnu/libcrypt.so.1 \
/lib/x86_64-linux-gnu/libpcre2-8.so.0 \
/lib/x86_64-linux-gnu/libssl.so.3 \
/lib/x86_64-linux-gnu/libcrypto.so.3 \
/lib/x86_64-linux-gnu/libz.so.1 \
/lib/x86_64-linux-gnu/

# Set the user to run NGINX
USER nonroot

# Expose the NGINX port
EXPOSE 8080

# Start NGINX
CMD ["/usr/sbin/nginx", "-g", "daemon off;"]

0 comments on commit 6311254

Please sign in to comment.