-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from goccy/release-image
Add workflow for release image
- Loading branch information
Showing
2 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: release image | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
build-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: docker/metadata-action@v3 | ||
id: meta | ||
with: | ||
images: ${{ env.REGISTRY }}/goccy/go-zetasql | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
- name: setup docker buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: cache for linux | ||
uses: actions/cache@v3 | ||
if: runner.os == 'Linux' | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=local,src=~/.cache/go-build | ||
build-args: | | ||
VERSION=v${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
FROM golang:1.21-bookworm | ||
|
||
ARG VERSION | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends clang | ||
|
||
ENV CGO_ENABLED 1 | ||
ENV CXX clang++ | ||
|
||
COPY . /go-zetasql | ||
WORKDIR /work | ||
|
||
COPY ./go.* ./ | ||
RUN go mod download | ||
|
||
COPY . ./ | ||
|
||
WORKDIR /go-zetasql | ||
RUN go install . |