Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releasing docker image for arm64 #1383

Merged
merged 2 commits into from Oct 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
sayboras marked this conversation as resolved.
Show resolved Hide resolved
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
sayboras marked this conversation as resolved.
Show resolved Hide resolved
# gcc is required to support cgo;
sayboras marked this conversation as resolved.
Show resolved Hide resolved
# 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"]