Skip to content

Commit 37751cb

Browse files
author
Anze
committed
Use multiplatform build
1 parent 5ce6c8d commit 37751cb

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

.github/workflows/on_release.yml

+20-2
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,40 @@ 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: amd64,arm
1620

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: true
26+
27+
- name: Set up Docker Buildx
28+
uses: crazy-max/ghaction-docker-buildx@v1
29+
with:
30+
version: latest
31+
32+
- name: Deploy to Docker Hub - ARMv7
1833
if: success() && startsWith(github.ref, 'refs/tags/v')
1934
env:
2035
GITHUB_REF_TAG: ${{ github.ref }}
2136
DOCKER_REGISTRY: docker.io
2237
DOCKER_IMAGE: grafolean/grafolean-snmp-bot
2338
DOCKER_USER: grafolean
2439
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
40+
BUILD_PLATFORMS: linux/arm/v7
2541
run: |
42+
echo "Available plaftorms: ${{ steps.buildx.outputs.platforms }}"
43+
echo "Building for plaftorms: $BUILD_PLATFORMS"
2644
export VERSION=${GITHUB_REF_TAG:10:50}
2745
echo "Version is $VERSION"
2846
export LAST_KNOWN_VERSION=`git tag -l --sort=-version:refname "v*.*.*" | grep -v rc | head -n 1 | tr -d '[:space:]'`
2947
echo "Last known version is $LAST_KNOWN_VERSION"
3048
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') .
49+
docker buildx 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') .
3250
[ "$LAST_KNOWN_VERSION" == "$VERSION" ] && docker tag "docker.io/$DOCKER_IMAGE:$VERSION" "docker.io/$DOCKER_IMAGE:latest" || echo "NOT MARKING AS LATEST!"
3351
docker images
3452
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)