Merge pull request #259 from gleanerio/dependabot/go_modules/golang.o… #130
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dockerize Gleaner | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v3.* | |
release: | |
types: [published] | |
# https://github.com/marketplace/actions/publish-docker | |
# https://github.com/docker/build-push-action | |
jobs: | |
build: | |
name: Release Go Binary | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# build and publish in parallel: linux/amd64 | |
#goos: [linux, windows, darwin] | |
#goarch: [amd64,arm64] | |
goos: [linux] | |
goarch: [amd64, arm64] | |
exclude: | |
- goarch: "386" | |
goos: darwin | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
- name: checkout code | |
uses: actions/checkout@v2 | |
- name: donwload schema | |
run: curl https://schema.org/version/latest/schemaorg-current-https.jsonld --output assets/schemaorg-current-https.jsonld | |
- name: donwload schema | |
run: curl https://schema.org/version/latest/schemaorg-current-http.jsonld --output assets/schemaorg-current-http.jsonld | |
# - name: Run tests | |
# run: go test -v -p=1 -timeout=0 ./... | |
- id: binary | |
name: build | |
run: | | |
go build -o gleaner | |
working-directory: ./cmd/gleaner | |
env: | |
GOOS: linux | |
GOARCH: amd64 | |
CGO_ENABLED: 0 | |
# deploy: | |
# needs: build | |
# name: Dockerize Gleaner | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout Repo | |
# uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: 'arm64,arm' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: nsfearthcube/gleaner | |
flavor: | | |
latest=true | |
tags: | | |
type=ref,event=tag | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
file: ./build/Dockerfile | |
context: . | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |