Skip to content

Commit

Permalink
Releasing docker image for arm64
Browse files Browse the repository at this point in the history
Signed-off-by: odidev <[email protected]>
  • Loading branch information
odidev committed Aug 10, 2020
1 parent 20814be commit cf45b63
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 21 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pr-extra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
- v*
branches:
- master
- arm_support
pull_request:
jobs:
vulns:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- v*
branches:
- master
- arm_support
pull_request:
jobs:
# We already run the current golangci-lint in tests, but here we test
Expand Down
40 changes: 39 additions & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,50 @@ jobs:
go-version: 1.14
- name: Unshallow
run: git fetch --prune --unshallow
- 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 buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
version: latest
- name: Login do docker.io
run: docker login -u golangci -p ${{ secrets.GOLANGCI_LINT_DOCKER_TOKEN }}
run: docker login -u odidev -p ${{ secrets.GOLANGCI_LINT_DOCKER_TOKEN }}
- name: Create release
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GOLANGCI_LINT_TOKEN }}
- name: build (and publish) main image
env:
DOCKER_REPO: ${{ secrets.DOCKER_REPO }}
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
--build-arg VERSION=${{ steps.prepare.outputs.tag_name }} \
--push \
-t ${DOCKER_REPO:-odidev/golangci-lint}:${{ steps.prepare.outputs.tag_name }} \
-t ${DOCKER_REPO:-odidev/golangci-lint}:${{ steps.prepare.outputs.major_tag }} \
-t ${DOCKER_REPO:-odidev/golangci-lint}:latest \
-f build/Dockerfile \
.
- name: build (and publish) alpine image
env:
DOCKER_REPO: ${{ secrets.DOCKER_REPO }}
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
--build-arg VERSION=${{ steps.prepare.outputs.tag_name }} \
--push \
-t ${DOCKER_REPO:-odidev/golangci-lint}:${{ steps.prepare.outputs.tag_name }}-alpine \
-t ${DOCKER_REPO:-odidev/golangci-lint}:${{ steps.prepare.outputs.major_tag }}-alpine \
-t ${DOCKER_REPO:-odidev/golangci-lint}:latest-alpine \
-f build/Dockerfile.alpine \
.
20 changes: 2 additions & 18 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project_name: golangci-lint

release:
github:
owner: golangci
owner: odidev
name: golangci-lint

builds:
Expand Down Expand Up @@ -63,25 +63,9 @@ 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
owner: odidev
name: homebrew-tap
folder: Formula
homepage: https://golangci.com
Expand Down
4 changes: 3 additions & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM golang:1.14

# don't place it into $GOPATH/bin because Drone mounts $GOPATH as volume
COPY golangci-lint /usr/bin/
RUN git clone https://github.com/odidev/golangci-lint
WORKDIR golangci-lint
RUN go build -o /usr/bin/golangci-lint ./cmd/golangci-lint/main.go
CMD ["golangci-lint"]
4 changes: 3 additions & 1 deletion build/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ FROM golang:1.14-alpine
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/
RUN git clone https://github.com/odidev/golangci-lint
WORKDIR golangci-lint
RUN CGO_ENABLED=0 go build -o /usr/bin/golangci-lint ./cmd/golangci-lint/main.go
CMD ["golangci-lint"]

0 comments on commit cf45b63

Please sign in to comment.