Skip to content

Commit

Permalink
ci: build image
Browse files Browse the repository at this point in the history
  • Loading branch information
mnacharov committed May 14, 2024
1 parent 5b38d34 commit ea1cae8
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build Docker Image

on:
push:
branches:
- main
tags:
- "v*"

jobs:
build-images:
runs-on: ubuntu-latest
outputs:
author-name: ${{ steps.author-name.outputs.author-name }}
author-email: ${{ steps.author-email.outputs.author-email }}
tag: ${{ steps.tag.outputs.tag }}
steps:
- uses: actions/[email protected]
- name: Docker meta
id: meta
uses: docker/[email protected]
with:
images: europe-west4-docker.pkg.dev/iaas-383414/iaas/grafana-datasource-oauth-proxy
tags: |
type=ref,event=tag
type=sha,event=branch,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
flavor: |
latest=false
- name: Login to GAR
uses: docker/[email protected]
with:
registry: europe-west4-docker.pkg.dev
username: _json_key
password: "${{ secrets.GOOGLE_ARTIFACTREGISTRY_CREDENTIALS }}"
- name: Build and push
uses: docker/[email protected]
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM golang:1.22.3-bookworm as build

WORKDIR /go/src/grafana-datasource-oauth-proxy
COPY go.mod go.sum ./
RUN go mod download && go mod verify

COPY . .
RUN CGO_ENABLED=0 go build -v -o /go/bin/grafana-datasource-oauth-proxy ./...

FROM gcr.io/distroless/static-debian12:latest

COPY --from=build /go/bin/grafana-datasource-oauth-proxy /

CMD ["/grafana-datasource-oauth-proxy"]

0 comments on commit ea1cae8

Please sign in to comment.