Skip to content

Commit

Permalink
add docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
mpostument committed Feb 16, 2023
1 parent a078b0f commit 3092cdf
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/publish_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Docker Publish

on:
push:
tags:
- "*"

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: Log in to the Container registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Build App
FROM golang:1.20.0-alpine3.17 AS builder

WORKDIR ${GOPATH}/src/github.com/mpostument/awstaghelper
COPY . ${GOPATH}/src/github.com/mpostument/awstaghelper

RUN go build -o /go/bin/awstaghelper .


# Create small image with binary
FROM alpine:3.17

RUN apk --no-cache add ca-certificates

COPY --from=builder /go/bin/awstaghelper /usr/bin/awstaghelper

ENTRYPOINT ["/usr/bin/awstaghelper"]

0 comments on commit 3092cdf

Please sign in to comment.