automating multi-platform builds
This commit is contained in:
parent
fd8a4555c4
commit
fa0997486f
1 changed files with 31 additions and 9 deletions
40
.github/workflows/docker-autobuild.yml
vendored
40
.github/workflows/docker-autobuild.yml
vendored
|
@ -5,13 +5,37 @@ on: [push]
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
build-upload:
|
build-upload:
|
||||||
name: Build Image and Upload to Docker Hub
|
name: Build Muilti-Platform Image and Upload to Docker Hub
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo
|
-
|
||||||
|
name: Build Docker buildx
|
||||||
|
run: |
|
||||||
|
export DOCKER_CLI_EXPERIMENTAL=enabled
|
||||||
|
export DOCKER_BUILDKIT=1
|
||||||
|
docker build --platform=local -o . git://github.com/docker/buildx
|
||||||
|
mkdir -p ~/.docker/cli-plugins && mv buildx ~/.docker/cli-plugins/docker-buildx
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Docker Version
|
||||||
|
run: |
|
||||||
|
echo "DOCKER VERSION:"
|
||||||
|
docker version
|
||||||
|
echo "BUILDX VERSION:"
|
||||||
|
docker buildx version
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Checkout Repo
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
- name: Build and Upload
|
-
|
||||||
|
name: Create Builder Instance
|
||||||
|
run: |
|
||||||
|
docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d
|
||||||
|
docker buildx create --use --name mybuilder
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Build and Upload
|
||||||
env:
|
env:
|
||||||
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
|
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
@ -22,10 +46,8 @@ jobs:
|
||||||
# Build image
|
# Build image
|
||||||
docker build --tag ${NAME}:${TAG} .
|
docker build --tag ${NAME}:${TAG} .
|
||||||
|
|
||||||
# Push image as current version
|
# Build image as TAG version
|
||||||
docker login -u silentdigit -p ${DOCKER_TOKEN}
|
docker buildx build -t ${NAME}:${TAG} --platform=linux/arm,linux/arm64,linux/amd64 . --push
|
||||||
docker push ${NAME}:${TAG}
|
|
||||||
|
|
||||||
# Push image as latest
|
# Build image as latest version
|
||||||
docker tag ${NAME}:${TAG} ${NAME}:latest
|
docker buildx build -t ${NAME}:latest --platform=linux/arm,linux/arm64,linux/amd64 . --push
|
||||||
docker push ${NAME}:latest
|
|
||||||
|
|
Loading…
Reference in a new issue