Skip to content

Commit

Permalink
Add Docker build upon release
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkwouter committed May 16, 2024
1 parent 2d91995 commit 2e66f90
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Docker

on:
push:
tags:
- "*"

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Create RELEASE.txt
run: |
echo "GIT_COMMIT=${{ github.sha }}" > RELEASE.txt
echo "VERSION=${{ github.ref_name }}" >> RELEASE.txt
cat RELEASE.txt
- name: Login to GitHub registry
uses: docker/login-action@v3
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io

- name: Build and push Docker container to GitHub registry
uses: docker/build-push-action@v5
with:
context: .
push: true
labels: |
git_commit=${{ github.sha }}
version=${{ github.ref_name }}
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM golang:alpine

COPY . /src

RUN cd /src && \
apk add --no-cache make git && \
make

FROM alpine:latest

COPY --from=0 /src/gscloud /usr/bin/gscloud
ENTRYPOINT ["/usr/bin/gscloud"]

0 comments on commit 2e66f90

Please sign in to comment.