Skip to content

Commit

Permalink
Merge pull request #36 from goccy/release-image
Browse files Browse the repository at this point in the history
Add workflow for release image
  • Loading branch information
goccy authored Dec 10, 2023
2 parents 872fafd + fe2b0d9 commit e538874
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
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'] }}
11 changes: 9 additions & 2 deletions Dockerfile
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 .

0 comments on commit e538874

Please sign in to comment.