forked from bokysan/docker-postfix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move from Docker Hub builds to GitHub Actions
This allows us to create do a multi-arch build, resulting in an image which is useful even on low-end IoT devices.
- Loading branch information
Showing
6 changed files
with
101 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Docker image | ||
|
||
on: | ||
push: | ||
branches: master | ||
|
||
jobs: | ||
buildx: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Get release version | ||
run: echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:10}) | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: crazy-max/ghaction-docker-buildx@v1 | ||
with: | ||
version: latest | ||
- name: Build master | ||
env: | ||
DOCKER_USERNAME: 'boky' | ||
DOCKER_PASSWORD: '${{ secrets.DOCKER_ACCESS_TOKEN }}' | ||
PLATFORMS: "linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x" | ||
run: ./build.sh -t boky/postfix --push | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Validate pull request | ||
|
||
on: | ||
pull_request: | ||
branches: master | ||
|
||
jobs: | ||
buildx: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: crazy-max/ghaction-docker-buildx@v1 | ||
with: | ||
version: latest | ||
- name: Run Buildx | ||
env: | ||
PLATFORMS: "linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x" | ||
run: ./build.sh -t boky/postfix | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Docker tag image | ||
|
||
on: | ||
push: | ||
tags: ['*'] | ||
|
||
jobs: | ||
buildx: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: crazy-max/ghaction-docker-buildx@v1 | ||
with: | ||
version: latest | ||
- name: Build branch / tag | ||
env: | ||
DOCKER_USERNAME: 'boky' | ||
DOCKER_PASSWORD: '${{ secrets.DOCKER_ACCESS_TOKEN }}' | ||
PLATFORMS: "linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x" | ||
run: ./build.sh -t boky/postfix:$(echo ${GITHUB_REF:10}) --push | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Do a multistage build | ||
|
||
export DOCKER_BUILDKIT=1 | ||
export DOCKER_CLI_EXPERIMENTAL=enabled | ||
|
||
if ! docker buildx inspect multiarch > /dev/null; then | ||
docker buildx create --name multiarch | ||
fi | ||
docker buildx use multiarch | ||
|
||
if [[ "$*" == *--push* ]]; then | ||
if [[ -n "$DOCKER_USERNAME" ]] && [[ -n "$DOCKER_PASSWORD" ]]; then | ||
echo "Logging into docker registry $DOCKER_REGISTRY_URL...." | ||
echo "$DOCKER_PASSWORD" | docker login --username $DOCKER_USERNAME --password-stdin $DOCKER_REGISTRY_URL | ||
fi | ||
fi | ||
|
||
if [[ -z "$PLATFORMS" ]]; then | ||
PLATFORMS="linux/amd64,linux/arm64,linux/arm/v7" | ||
fi | ||
|
||
docker buildx build --platform $PLATFORMS . $* | ||
|