Skip to content

Commit

Permalink
Try targetplatform
Browse files Browse the repository at this point in the history
  • Loading branch information
aweakley committed Jun 24, 2024
1 parent 8db2747 commit 439e27f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
image:
env:
IMAGE_REPO: ${{ secrets.DOCKER_ORG }}/${{ secrets.DOCKER_REPO }}
IMAGE_TAG: sha-${{ github.sha }}
IMAGE_TAG: sha-${{ github.sha }}-${{ matrix.arch }}
runs-on:
- linux
- self-hosted
Expand All @@ -27,14 +27,28 @@ jobs:
tags: ${{ env.IMAGE_REPO }}:sha-${{ env.IMAGE_TAG }}
- name: Push branch tag
run: |
docker tag ${{ env.IMAGE_REPO }}:sha-${{ env.IMAGE_TAG }} ${{ env.IMAGE_REPO }}:${GITHUB_REF#refs/heads/}
docker tag ${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} ${{ env.IMAGE_REPO }}:${GITHUB_REF#refs/heads/}
docker push ${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}
docker push ${{ env.IMAGE_REPO }}:${GITHUB_REF#refs/heads/}
- name: Push 'latest' tag
if: github.ref == 'refs/heads/master'
run: |
docker tag ${{ env.IMAGE_REPO }}:sha-${{ env.IMAGE_TAG }} ${{ env.IMAGE_REPO }}:latest
docker tag ${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} ${{ env.IMAGE_REPO }}:latest
docker push ${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}
docker push ${{ env.IMAGE_REPO }}:latest
- name: Cleanup
if: always()
run: |
export COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME//\//-}
docker-compose down --volumes
docker rmi -f \
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }} \
${{ env.IMAGE_REPO }}:${GITHUB_REF#refs/heads/}
if [[ "$BRANCH" == master ]]; then
docker rmi -f ${{ env.IMAGE_REPO }}:latest
fi
strategy:
matrix:
arch:
Expand Down
13 changes: 6 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ RUN apk update \

ENV DOCKERIZE_VERSION=0.5.0

RUN apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
armhf) export DOCKERIZE_ARCH='armhf' ;; \
x86) export DOCKERIZE_ARCH='amd64' ;; \
esac;

RUN wget -nv -O - "https://github.com/jwilder/dockerize/releases/download/v${DOCKERIZE_VERSION}/dockerize-linux-${DOCKERIZE_ARCH}-v${DOCKERIZE_VERSION}.tar.gz" | tar -xz -C /usr/local/bin/ -f -
ARG TARGETPLATFORM
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then DOCKERIZE_ARCH=amd64; elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then DOCKERIZE_ARCH=armhf; else DOCKERIZE_ARCH=amd64; fi \
&& echo "TARGETPLATFORM=${TARGETPLATFORM}" \
&& echo "DOCKERIZE_ARCH=${DOCKERIZE_ARCH}" \
&& echo "DOCKERIZE_VERSION=${DOCKERIZE_VERSION}" \
&& wget -nv -O - "https://github.com/jwilder/dockerize/releases/download/v${DOCKERIZE_VERSION}/dockerize-linux-${DOCKERIZE_ARCH}-v${DOCKERIZE_VERSION}.tar.gz" | tar -xz -C /usr/local/bin/ -f -

ENV PATH="$PATH:/opt/restic-pg-dump/bin"

Expand Down

0 comments on commit 439e27f

Please sign in to comment.