-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from eurofurence/issue-44-docker
feat(#44): add Docker build and publish
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ target | |
config.yaml | ||
*.http | ||
**/*.jar | ||
api-generator | ||
|
||
# Remove this line when implementing custom tools | ||
tools/cmd/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |