Skip to content

Commit

Permalink
Releasing docker image for arm64 (#1383)
Browse files Browse the repository at this point in the history
  • Loading branch information
odidev committed Oct 18, 2020
1 parent 3e6b01e commit 3368a55
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 21 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/tag.yml
Expand Up @@ -26,3 +26,38 @@ jobs:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GOLANGCI_LINT_TOKEN }}
- name: Prepare
id: prepare
run: |
TAG=${GITHUB_REF#refs/tags/}
MAJOR=${TAG%.*}
echo ::set-output name=tag_name::${TAG}
echo ::set-output name=major_tag::${MAJOR}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: build and publish main image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: build/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
golangci/golangci-lint:${{ steps.prepare.outputs.tag_name }}
golangci/golangci-lint:${{ steps.prepare.outputs.major_tag }}
golangci/golangci-lint:latest
- name: build and publish alpine image
id: docker_build_alpine
uses: docker/build-push-action@v2
with:
context: .
file: build/Dockerfile.alpine
platforms: linux/amd64,linux/arm64
push: true
tags: |
golangci/golangci-lint:${{ steps.prepare.outputs.tag_name }}-alpine
golangci/golangci-lint:${{ steps.prepare.outputs.major_tag }}-alpine
golangci/golangci-lint:latest-alpine
16 changes: 0 additions & 16 deletions .goreleaser.yml
Expand Up @@ -63,22 +63,6 @@ changelog:
- Merge pull request
- Merge branch

dockers:
- dockerfile: build/Dockerfile
binaries:
- golangci-lint
image_templates:
- "golangci/golangci-lint:latest"
- "golangci/golangci-lint:{{ .Tag }}"
- "golangci/golangci-lint:v{{ .Major }}.{{ .Minor }}"
- dockerfile: build/Dockerfile.alpine
binaries:
- golangci-lint
image_templates:
- "golangci/golangci-lint:latest-alpine"
- "golangci/golangci-lint:{{ .Tag }}-alpine"
- "golangci/golangci-lint:v{{ .Major }}.{{ .Minor }}-alpine"

brews:
- tap:
owner: golangci
Expand Down
11 changes: 9 additions & 2 deletions build/Dockerfile
@@ -1,5 +1,12 @@
FROM golang:1.15
# stage 1 building the code
FROM golang:1.15 as builder

COPY / /golangci
WORKDIR /golangci
RUN go build -o golangci-lint ./cmd/golangci-lint/main.go

# stage 2
FROM golang:1.15
# don't place it into $GOPATH/bin because Drone mounts $GOPATH as volume
COPY golangci-lint /usr/bin/
COPY --from=builder /golangci/golangci-lint /usr/bin/
CMD ["golangci-lint"]
12 changes: 9 additions & 3 deletions build/Dockerfile.alpine
@@ -1,10 +1,16 @@
FROM golang:1.15-alpine
# stage 1 building the code
FROM golang:1.15-alpine as builder

COPY / /golangci
WORKDIR /golangci
RUN CGO_ENABLED=0 go build -o golangci-lint ./cmd/golangci-lint/main.go

# stage 2
FROM golang:1.15-alpine
# gcc is required to support cgo;
# git and mercurial are needed most times for go get`, etc.
# See https://github.com/docker-library/golang/issues/80
RUN apk --no-cache add gcc musl-dev git mercurial

# don't place it into $GOPATH/bin because Drone mounts $GOPATH as volume
COPY golangci-lint /usr/bin/
COPY --from=builder /golangci/golangci-lint /usr/bin/
CMD ["golangci-lint"]

0 comments on commit 3368a55

Please sign in to comment.