Skip to content

Commit

Permalink
Merge pull request #45 from eurofurence/issue-44-docker
Browse files Browse the repository at this point in the history
feat(#44): add Docker build and publish
  • Loading branch information
Jumpy-Squirrel authored Oct 7, 2023
2 parents fad09fb + a8ed9d4 commit 0752723
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Create and publish Docker image

on:
push:
branches:
- 'main'

jobs:
call-build-and-push-image:
permissions:
contents: read
packages: write
uses: eurofurence/reg-workflows/.github/workflows/docker-build-push.yml@main
with:
image-name: ${{ github.repository }}
image-tags: latest
full-repo-url: https://github.com/${{ github.repository }}
branch-or-tag-name: ${{ github.ref_name }}
commit-hash: ${{ github.sha }}
registry-user: ${{ github.actor }}
secrets:
registry-pass: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ target
config.yaml
*.http
**/*.jar
api-generator

# Remove this line when implementing custom tools
tools/cmd/**
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM golang:1 as build

COPY . /app
WORKDIR /app

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" cmd/reg-room-service/main.go

RUN chmod 755 main

FROM scratch

COPY --from=build /app/main /main
COPY --from=build /etc/ssl/certs /etc/ssl/certs

# run as an unprivileged unnamed user that has no write permissions on the binary
USER 8877

ENTRYPOINT ["/main"]

0 comments on commit 0752723

Please sign in to comment.