Skip to content

Commit

Permalink
Setup GH Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
harshsinghvi committed Nov 16, 2023
1 parent 84cccc3 commit fcba606
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: ci

on:
push:
branches:
- "main"
- "master"

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GH_TOKEN}}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/harshsinghvi/golang-postgres-kubernetes:latest
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# STEP 1 build executable binary
############################
FROM golang:alpine AS builder
LABEL org.opencontainers.image.source="https://github.com/harshsinghvi/golang-postgres-kubernetes"
# Install git.
# Git is required for fetching the dependencies.
RUN apk update && apk add --no-cache 'git=~2'
Expand All @@ -22,6 +23,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /go/main .
# STEP 2 build a small image
############################
FROM alpine
LABEL org.opencontainers.image.source="https://github.com/harshsinghvi/golang-postgres-kubernetes"

WORKDIR /

Expand Down

0 comments on commit fcba606

Please sign in to comment.