Skip to content

Commit

Permalink
Update pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
DRuggeri committed Sep 6, 2021
1 parent 035372c commit 2d9be91
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ jobs:
echo "PROJECT_NAME=$PROJECT_NAME" >> $GITHUB_ENV
echo "TAG=$TAG" >> $GITHUB_ENV
echo "URL_LINUX_AMD64=https://github.com/${GITHUB_REPOSITORY}/releases/download/$TAG/${PROJECT_NAME}-${TAG}-linux-amd64" >> $GITHUB_ENV
echo "URL_LINUX_ARM64=https://github.com/${GITHUB_REPOSITORY}/releases/download/$TAG/${PROJECT_NAME}-${TAG}-linux-arm64" >> $GITHUB_ENV
echo "URL_LINUX_ARM=https://github.com/${GITHUB_REPOSITORY}/releases/download/$TAG/${PROJECT_NAME}-${TAG}-linux-arm" >> $GITHUB_ENV
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
Expand Down Expand Up @@ -109,12 +112,16 @@ jobs:
- name: Create scratch docker image
run: |
echo "
FROM golang:1.17.0-alpine3.14 AS builder
RUN apk --no-cache add git
RUN go install github.com/${{ github.repository }}@$TAG
FROM alpine AS builder
RUN apk --no-cache add wget \
&& if uname -m | grep 'x86_64' >/dev/null 2>&1; then wget -O /downloaded_file $URL_LINUX_AMD64;fi \
&& if uname -m | grep 'aarch64' >/dev/null 2>&1; then wget -O /downloaded_file $URL_LINUX_ARM64;fi \
&& if uname -m | grep 'arm' >/dev/null 2>&1; then wget -O /downloaded_file $URL_LINUX_ARM;fi \
&& if [ ! -f /downloaded_file ];then echo "===Failed to download for:";uname -m;echo "===";exit 1;fi \
&& chmod 755 /downloaded_file
FROM scratch
COPY --from=builder /go/bin/$PROJECT_NAME /$PROJECT_NAME
COPY --from=builder /downloaded_file /$PROJECT_NAME
ENTRYPOINT [\"/$PROJECT_NAME\"]
" > Dockerfile
Expand All @@ -125,7 +132,7 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64,linux/arm
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 2d9be91

Please sign in to comment.