Skip to content

Commit

Permalink
Add CI for container
Browse files Browse the repository at this point in the history
  • Loading branch information
Hcreak committed Oct 16, 2023
1 parent e7ee398 commit ec46fe9
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Building Images

on:
push:
branches:
- master

jobs:
build-image:
name: Build Image
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login Github Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Metadata for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/Hcreak/goflyway
tags: |
type=raw,value={{branch}}-{{sha}}-{{date 'x'}}
type=raw,value=latest
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM golang:alpine3.18 AS go-build

WORKDIR build
ADD . .

RUN go mod init goflyway
RUN go mod tidy | true
RUN go install

0 comments on commit ec46fe9

Please sign in to comment.