Skip to content

Commit 5b434c3

Browse files
committed
Image is now built with Github Actions and is multi-arch.
1 parent 0905fcb commit 5b434c3

File tree

5 files changed

+158
-177
lines changed

5 files changed

+158
-177
lines changed

.drone.yml

Lines changed: 0 additions & 86 deletions
This file was deleted.

.github/workflows/build-image.yml

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
name: Docker image CI/CD
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
env:
8+
DOCKER_IMAGE_NAME: jlesage/nginx-proxy-manager
9+
PLATFORMS: linux/amd64,linux/386,linux/arm/v6,linux/arm/v7,linux/arm64/v8
10+
11+
on:
12+
push:
13+
branches: '*'
14+
tags:
15+
- v[0-9][0-9].[0-9][0-9].[0-9]+
16+
- v[0-9][0-9].[0-9][0-9].[0-9]+-pre.[0-9]+
17+
pull_request:
18+
19+
jobs:
20+
build:
21+
name: Build image
22+
runs-on: ubuntu-20.04
23+
24+
steps:
25+
- name: Free disk space
26+
run: |
27+
# Free disk space.
28+
echo "::group::Before"
29+
df -h /
30+
echo "::endgroup::"
31+
echo "::group::Removing unneeded softwares and files..."
32+
for DIR in /usr/local/lib/android /usr/share/dotnet /opt/ghc
33+
do
34+
if [ -d "$DIR" ]; then
35+
echo "Removing $DIR..."
36+
sudo rm -r "$DIR"
37+
fi
38+
done
39+
echo "::endgroup::"
40+
echo "::group::After"
41+
df -h /
42+
echo "::endgroup::"
43+
44+
- name: Prepare
45+
id: prep
46+
run: |
47+
# Determine the Docker container version.
48+
VERSION=unknown
49+
if [[ $GITHUB_REF =~ refs/tags/* ]]; then
50+
# Git tag pushed: use tag as the version.
51+
VERSION=${GITHUB_REF#refs/tags/}
52+
elif [[ $GITHUB_REF =~ refs/heads/* ]]; then
53+
# Git commit pushed: use the commit SHA as the version.
54+
VERSION=${GITHUB_SHA::8}
55+
elif [[ $GITHUB_REF =~ refs/pull/* ]]; then
56+
# Pull request: use PR number as the version.
57+
VERSION=pr-${{ github.event.number }}
58+
else
59+
echo "::error::Unexpected GITHUB_REF: $GITHUB_REF"
60+
exit 1
61+
fi
62+
# Determine the version to put in container label.
63+
LABEL_VERSION=${VERSION}
64+
if [[ $GITHUB_REF =~ refs/tags/* ]]; then
65+
# Do not include the starting 'v' of the version.
66+
LABEL_VERSION=${VERSION:1}
67+
fi
68+
# Determine the Docker container tags.
69+
TAGS="${{ env.DOCKER_IMAGE_NAME }}:${VERSION}"
70+
if [[ $GITHUB_REF =~ refs/tags/* ]]; then
71+
TAGS="$TAGS,${{ env.DOCKER_IMAGE_NAME }}:latest"
72+
fi
73+
# Determine the release type.
74+
if [[ $GITHUB_REF =~ refs/tags/* ]]; then
75+
IS_RELEASE=yes
76+
if [[ $GITHUB_REF =~ -pre\.[0-9]+ ]]; then
77+
RELEASE_TYPE="pre"
78+
else
79+
RELEASE_TYPE="standard"
80+
fi
81+
else
82+
IS_RELEASE=no
83+
RELEASE_TYPE="n/a"
84+
fi
85+
# Print results.
86+
echo "::group::Results"
87+
echo "Github reference: $GITHUB_REF"
88+
echo "Release: $IS_RELEASE"
89+
echo "Release type: $RELEASE_TYPE"
90+
echo "Docker container version: $VERSION"
91+
echo "Docker container version label: $LABEL_VERSION"
92+
echo "Docker container tag(s): $TAGS"
93+
echo "::endgroup::"
94+
# Export outputs.
95+
echo "is_release=${IS_RELEASE}" >> $GITHUB_OUTPUT
96+
echo "release_type=${RELEASE_TYPE}" >> $GITHUB_OUTPUT
97+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
98+
echo "label_version=${LABEL_VERSION}" >> $GITHUB_OUTPUT
99+
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
100+
#echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
101+
102+
- name: Checkout
103+
uses: actions/checkout@v3
104+
105+
- name: Setup QEMU
106+
uses: docker/setup-qemu-action@v2
107+
with:
108+
platforms: arm,arm64,ppc64le,mips64,s390x
109+
110+
- name: Setup Docker Buildx
111+
uses: docker/setup-buildx-action@v2
112+
113+
- name: Login to DockerHub
114+
if: ${{ steps.prep.outputs.is_release == 'yes' }}
115+
uses: docker/login-action@v2
116+
with:
117+
username: ${{ secrets.DOCKERHUB_USERNAME }}
118+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
119+
120+
- name: Build and push
121+
uses: docker/build-push-action@v4
122+
with:
123+
push: ${{ steps.prep.outputs.is_release == 'yes' }}
124+
provenance: false
125+
platforms: ${{ env.PLATFORMS }}
126+
tags: ${{ steps.prep.outputs.tags }}
127+
build-args: |
128+
DOCKER_IMAGE_VERSION=${{ steps.prep.outputs.label_version }}
129+
cache-from: type=gha,scope=${{ env.DOCKER_IMAGE_NAME }}
130+
cache-to: type=gha,mode=max,scope=${{ env.DOCKER_IMAGE_NAME }}
131+
132+
- name: Inspect
133+
if: ${{ steps.prep.outputs.is_release == 'yes' }}
134+
run: |
135+
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE_NAME }}:${{ steps.prep.outputs.version }}
136+
137+
- name: Dockerhub description
138+
if: ${{ steps.prep.outputs.release_type == 'standard' }}
139+
uses: peter-evans/dockerhub-description@v3
140+
with:
141+
username: ${{ secrets.DOCKERHUB_USERNAME }}
142+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
143+
repository: ${{ env.DOCKER_IMAGE_NAME }}
144+
readme-filepath: DOCKERHUB.md
145+
146+
notification:
147+
name: Notification
148+
needs: [ build ]
149+
runs-on: ubuntu-20.04
150+
if: ${{ always() }}
151+
152+
steps:
153+
- name: Pushover notification
154+
uses: desiderati/github-action-pushover@v1
155+
with:
156+
job-status: ${{ needs.build.result }}
157+
pushover-api-token: ${{ secrets.PUSHOVER_API_TOKEN }}
158+
pushover-user-key: ${{ secrets.PUSHOVER_USER_KEY }}

.travis.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

hooks/post_push

Lines changed: 0 additions & 39 deletions
This file was deleted.

hooks/pre_build

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)