diff --git a/.github/workflows/build_dev.yml b/.github/workflows/build_dev.yml index 28c76e0e..3866bf1e 100644 --- a/.github/workflows/build_dev.yml +++ b/.github/workflows/build_dev.yml @@ -18,5 +18,6 @@ jobs: uses: docker/build-push-action@v2 with: push: true + file: "./Dockerfile.dev" tags: | odpf/columbus:dev diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..04a1e495 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +name: release + +on: + push: + tags: + - 'v*.*.*' + workflow_dispatch: + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '^1.16' + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + registry: docker.io + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2.6.1 + with: + distribution: goreleaser + version: latest + args: --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GO_RELEASER_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000..b738936c --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,79 @@ +project_name: columbus + +release: + prerelease: auto + draft: true + +before: + hooks: + - go mod tidy + - make clean + +builds: + - main: ./main.go + binary: columbus + flags: [-a] + ldflags: + - -X github.com/odpf/columbus/cmd.Version={{.Tag}} + - -X github.com/odpf/columbus/cmd.BuildCommit={{.FullCommit}} + - -X github.com/odpf/columbus/cmd.BuildDate={{.Date}} + goos: [linux, darwin, windows] + goarch: [amd64, 386, arm, arm64] # skip goarch 386 and arm due to conflicts with "github.com/blastrain/vitess-sqlparser" library + env: + - CGO_ENABLED=0 + +archives: + - replacements: + darwin: macos + linux: linux + windows: windows + 386: i386 + amd64: x86_64 + format_overrides: + - goos: windows + format: zip + +checksum: + name_template: 'checksums.txt' + +snapshot: + name_template: "{{ .Tag }}-next" + +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + - '^build:' + +dockers: + - + goos: linux + goarch: amd64 + ids: + - linux + dockerfile: Dockerfile + image_templates: + - 'docker.io/odpf/{{.ProjectName}}:latest' + - 'docker.io/odpf/{{.ProjectName}}:{{ .Version }}' + - 'docker.io/odpf/{{.ProjectName}}:{{ .Version }}-amd64' + +brews: + - name: columbus + homepage: "https://github.com/odpf/columbus" + description: "Metadata Discovery and Lineage Service" + tap: + owner: odpf + name: homebrew-taps + license: "Apache 2.0" + folder: Formula + + dependencies: + - name: git + install: |- + bin.install "columbus" + commit_author: + name: Ravi Suhag + email: suhag.ravi@gmail.com + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 1b239935..3f40736e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,7 @@ -FROM golang:1.16-stretch as base -WORKDIR /build/ -COPY . . -RUN ["make"] - FROM alpine:latest -WORKDIR /opt/columbus -COPY --from=base /build/columbus /opt/columbus/bin/columbus -RUN ["apk", "update"] -EXPOSE 8080 -# glibc compatibility library, since go binaries -# don't work well with musl libc that alpine uses -RUN ["apk", "add", "libc6-compat"] -ENTRYPOINT ["/opt/columbus/bin/columbus"] \ No newline at end of file +COPY columbus /usr/bin/columbus +RUN apk update +RUN apk add ca-certificates + +CMD ["columbus"] diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 00000000..1b239935 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,15 @@ +FROM golang:1.16-stretch as base +WORKDIR /build/ +COPY . . +RUN ["make"] + +FROM alpine:latest +WORKDIR /opt/columbus +COPY --from=base /build/columbus /opt/columbus/bin/columbus +RUN ["apk", "update"] +EXPOSE 8080 + +# glibc compatibility library, since go binaries +# don't work well with musl libc that alpine uses +RUN ["apk", "add", "libc6-compat"] +ENTRYPOINT ["/opt/columbus/bin/columbus"] \ No newline at end of file