@@ -13,23 +13,33 @@ jobs:
13
13
- name : Checkout source code
14
14
uses : actions/checkout@v1
15
15
16
+ - name : Set up QEMU for more platforms
17
+ uses : docker/setup-qemu-action@v1
18
+ with :
19
+ platforms : all
16
20
17
- - name : Deploy to Docker Hub
21
+ - name : Set docker build as alias to buildx (multiarch build)
22
+ uses : docker/setup-buildx-action@v1
23
+ id : buildx
24
+ with :
25
+ install : false
26
+
27
+ - name : Deploy to Docker Hub - ARMv7
18
28
if : success() && startsWith(github.ref, 'refs/tags/v')
19
29
env :
20
30
GITHUB_REF_TAG : ${{ github.ref }}
21
31
DOCKER_REGISTRY : docker.io
22
32
DOCKER_IMAGE : grafolean/grafolean-snmp-bot
23
33
DOCKER_USER : grafolean
24
34
DOCKER_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
35
+ BUILD_PLATFORMS : linux/amd64,linux/arm/v7,linux/arm64
25
36
run : |
37
+ echo "Available plaftorms: ${{ steps.buildx.outputs.platforms }}"
38
+ echo "Building for plaftorms: $BUILD_PLATFORMS"
26
39
export VERSION=${GITHUB_REF_TAG:10:50}
27
40
echo "Version is $VERSION"
28
41
export LAST_KNOWN_VERSION=`git tag -l --sort=-version:refname "v*.*.*" | grep -v rc | head -n 1 | tr -d '[:space:]'`
29
42
echo "Last known version is $LAST_KNOWN_VERSION"
30
43
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD $DOCKER_REGISTRY
31
- docker build -t "docker.io/$DOCKER_IMAGE:$VERSION" -t "docker.io/$DOCKER_IMAGE:latest" --build-arg VERSION=$VERSION --build-arg VCS_REF=$GITHUB_SHA --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') .
32
- [ "$LAST_KNOWN_VERSION" == "$VERSION" ] && docker tag "docker.io/$DOCKER_IMAGE:$VERSION" "docker.io/$DOCKER_IMAGE:latest" || echo "NOT MARKING AS LATEST!"
33
- docker images
34
- docker push "docker.io/$DOCKER_IMAGE:$VERSION"
35
- [ "$LAST_KNOWN_VERSION" == "$VERSION" ] && docker push "docker.io/$DOCKER_IMAGE:latest" || echo "NOT LATEST!"
44
+ [ "$LAST_KNOWN_VERSION" == "$VERSION" ] && echo "MARKING AS LATEST!" || echo "NOT MARKING AS LATEST!"
45
+ [ "$LAST_KNOWN_VERSION" == "$VERSION" ] && docker buildx build --push --platform "$BUILD_PLATFORMS" -t "docker.io/$DOCKER_IMAGE:$VERSION" -t "docker.io/$DOCKER_IMAGE:latest" --build-arg VERSION=$VERSION --build-arg VCS_REF=$GITHUB_SHA --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') . || docker buildx build --push --platform "$BUILD_PLATFORMS" -t "docker.io/$DOCKER_IMAGE:$VERSION" --build-arg VERSION=$VERSION --build-arg VCS_REF=$GITHUB_SHA --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') .
0 commit comments