Skip to content

Commit

Permalink
Merge pull request #7 from wongnai/whs/ci
Browse files Browse the repository at this point in the history
Add GH actions
  • Loading branch information
whs authored Aug 10, 2023
2 parents 1ba7485 + 428f793 commit 2372f0b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
40 changes: 40 additions & 0 deletions .github/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build docker
on:
push:
branches: [master]
tags: ['v*']
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM golang:1.20 AS builder
RUN go install -v -trimpath github.com/grpc-ecosystem/[email protected].6
RUN go install -v -trimpath github.com/grpc-ecosystem/[email protected].19
COPY . /build
WORKDIR /build
RUN make

FROM debian:bullseye
FROM debian:bookworm-slim
USER 0
COPY --from=builder /go/bin/grpc-health-probe /usr/bin/
COPY --from=builder /build/.bin/k8sxds /opt/k8sxds
Expand Down

0 comments on commit 2372f0b

Please sign in to comment.