Skip to content

Commit 402e10d

Browse files
author
Anze
committed
Use multiplatform build
1 parent 5ce6c8d commit 402e10d

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.github/workflows/on_release.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ jobs:
1313
- name: Checkout source code
1414
uses: actions/checkout@v1
1515

16+
- name: Set up QEMU for more platforms
17+
uses: docker/setup-qemu-action@v1
18+
with:
19+
platforms: all
20+
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: true
1626

1727
- name: Deploy to Docker Hub
1828
if: success() && startsWith(github.ref, 'refs/tags/v')
@@ -22,13 +32,16 @@ jobs:
2232
DOCKER_IMAGE: grafolean/grafolean-snmp-bot
2333
DOCKER_USER: grafolean
2434
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
35+
BUILD_PLATFORMS: linux/amd64,linux/arm/v7,linux/arm64
2536
run: |
37+
echo "Available plaftorms: ${{ steps.buildx.outputs.platforms }}"
38+
echo "Building for plaftorms: $BUILD_PLATFORMS"
2639
export VERSION=${GITHUB_REF_TAG:10:50}
2740
echo "Version is $VERSION"
2841
export LAST_KNOWN_VERSION=`git tag -l --sort=-version:refname "v*.*.*" | grep -v rc | head -n 1 | tr -d '[:space:]'`
2942
echo "Last known version is $LAST_KNOWN_VERSION"
3043
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') .
44+
docker build --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') .
3245
[ "$LAST_KNOWN_VERSION" == "$VERSION" ] && docker tag "docker.io/$DOCKER_IMAGE:$VERSION" "docker.io/$DOCKER_IMAGE:latest" || echo "NOT MARKING AS LATEST!"
3346
docker images
3447
docker push "docker.io/$DOCKER_IMAGE:$VERSION"

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ LABEL org.label-schema.vendor="Grafolean" \
3131
COPY --from=python-requirements /requirements.txt /requirements.txt
3232
RUN \
3333
apt-get update && \
34-
apt-get install --no-install-recommends -q -y libsnmp-dev build-essential git && \
34+
apt-get install --no-install-recommends -q -y libsnmp-dev build-essential libpq-dev python3-dev git && \
3535
pip install --no-cache-dir -r /requirements.txt && \
36-
apt-get purge -y build-essential && \
36+
apt-get purge -y build-essential libpq-dev python3-dev && \
3737
apt-get clean autoclean && \
3838
apt-get autoremove --yes && \
3939
rm -rf /var/lib/{apt,dpkg,cache,log}/ && \

0 commit comments

Comments
 (0)