Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(#44): add Docker build and publish #45

Merged
merged 2 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Jumpy-Squirrel marked this conversation as resolved.
Show resolved Hide resolved

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"]
Loading