-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Fmar
committed
Jan 29, 2024
1 parent
47e327a
commit 5001afd
Showing
3 changed files
with
57 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,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: gomod | ||
directory: / | ||
schedule: | ||
interval: weekly |
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,28 @@ | ||
name: Linux Docker build | ||
on: | ||
push: | ||
release: | ||
types: [published] | ||
jobs: | ||
build: | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGENAME: ${{ github.event.repository.name }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
name: Check out code | ||
- name: Install Go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.21.x | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Docker build | ||
uses: mr-smithers-excellent/docker-build-push@v6 | ||
id: build | ||
with: | ||
image: ${{ env.IMAGENAME }} | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.repository_owner }} | ||
password: ${{ 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM golang:1.21-alpine as builder | ||
|
||
# Move to working directory /build | ||
WORKDIR /build | ||
|
||
# Copy and download dependency using go mod | ||
COPY go.mod . | ||
COPY go.sum . | ||
RUN go mod download | ||
|
||
# Copy the code into the container | ||
COPY . . | ||
|
||
# Build the application | ||
RUN go build -o main cmd/server/main.go | ||
|
||
# Start a new, final image to reduce size. | ||
FROM alpine as final | ||
|
||
# Copy the binaries and entrypoint from the builder image. | ||
COPY --from=builder /build/main /bin/ | ||
|
||
ENTRYPOINT [ "/bin/main" ] |