Skip to content

Commit f0cf74d

Browse files
committed
First pass at implementing GitHub actions
This will allow new NGINX unprivileged Docker images to be built and pushed within GitHub actions
1 parent 5481a89 commit f0cf74d

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/build.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: build
3+
"on":
4+
workflow_dispatch:
5+
jobs:
6+
docker:
7+
name: Build Alpine Stable NGINX Docker image
8+
runs-on: ubuntu-20.04
9+
steps:
10+
- name: Check out the codebase
11+
uses: actions/checkout@v3
12+
- name: Set up QEMU
13+
uses: docker/setup-qemu-action@v1
14+
- name: Set up Docker Buildx
15+
uses: docker/setup-buildx-action@v1
16+
- name: Login to Docker Hub
17+
uses: docker/login-action@v1
18+
with:
19+
username: ${{ secrets.DOCKERHUB_USERNAME }}
20+
password: ${{ secrets.DOCKERHUB_TOKEN }}
21+
- name: Parse NGINX version
22+
id: version
23+
run: |
24+
echo "::set-output name=major::$(cat stable/alpine/Dockerfile | awk '$1 == "ENV" && $2 == "NGINX_VERSION" { print $3 }' | awk -F. '{ print $1 }')"
25+
echo "::set-output name=minor::$(cat stable/alpine/Dockerfile | awk '$1 == "ENV" && $2 == "NGINX_VERSION" { print $3 }' | awk -F. '{ print $2 }')"
26+
echo "::set-output name=patch::$(cat stable/alpine/Dockerfile | awk '$1 == "ENV" && $2 == "NGINX_VERSION" { print $3 }' | awk -F. '{ print $3 }')"
27+
- name: Build and push NGINX Alpine stable image
28+
uses: docker/build-push-action@v2
29+
with:
30+
platforms: linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64, linux/386, linux/ppc64le, linux/s390x
31+
context: "{{ defaultContext }}:stable/alpine"
32+
push: false
33+
tags: nginxinc/nginx-unprivileged:${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}-alpine, nginxinc/nginx-unprivileged:stable-alpine, nginxinc/nginx-unprivileged:${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}-alpine, stable/alpine

0 commit comments

Comments
 (0)