-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
24 changed files
with
256 additions
and
95 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,17 @@ | ||
.gitignore | ||
.dockerignore | ||
Dockerfile | ||
.github/ | ||
.git/ | ||
*.log | ||
.goac/ | ||
.goacproject.yaml | ||
.semver.yaml | ||
coverage.out | ||
goac | ||
*_test.go | ||
README.md | ||
LICENSE | ||
Makefile | ||
.DS_Store | ||
.idea |
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 |
---|---|---|
|
@@ -22,4 +22,5 @@ go.work | |
|
||
.goac | ||
goac | ||
.idea | ||
.idea | ||
.DS_Store |
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
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,21 @@ | ||
FROM golang:1.22-bookworm AS builder | ||
|
||
# Set Go env | ||
ENV GOOS=linux CGO_ENABLED=0 | ||
|
||
WORKDIR /workspace | ||
|
||
# Build Go binary | ||
COPY . . | ||
RUN --mount=type=cache,mode=0755,target=/go/pkg/mod \ | ||
--mount=type=cache,target=/root/.cache/go-build \ | ||
go mod download | ||
RUN --mount=type=cache,mode=0755,target=/go/pkg/mod \ | ||
--mount=type=cache,target=/root/.cache/go-build \ | ||
CGO_ENABLED=0 go build -ldflags="-s -w" -o /workspace/goac | ||
|
||
# Deployment container | ||
FROM gcr.io/distroless/static-debian12 | ||
|
||
COPY --from=builder /workspace/goac /goac | ||
ENTRYPOINT ["/goac"] |
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,33 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
: "${PUSH_IMAGE="false"}" | ||
|
||
: "${REPOSITORY="kperreau/goac"}" | ||
|
||
: "${PROJECT_PATH="."}" # project path (must be where the Dockerfile is) | ||
|
||
DOCKERFILE="${PROJECT_PATH}/Dockerfile" | ||
|
||
GIT_VERSION=$(git rev-parse --short=7 HEAD) | ||
|
||
dockerCmd=(docker buildx build --platform="linux/amd64,linux/arm64" --network host) | ||
|
||
if [[ "${PUSH_IMAGE}" == "true" ]]; then | ||
dockerCmd+=(--push); | ||
fi | ||
|
||
# print cmd | ||
echo "${dockerCmd[@]}" \ | ||
-t "${REPOSITORY}:latest" \ | ||
-t "${REPOSITORY}:${GIT_VERSION}" \ | ||
-f "${DOCKERFILE}" \ | ||
. | ||
|
||
# run docker build | ||
"${dockerCmd[@]}" \ | ||
-t "${REPOSITORY}:latest" \ | ||
-t "${REPOSITORY}:${GIT_VERSION}" \ | ||
-f "${DOCKERFILE}" \ | ||
. |
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
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
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
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
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
Oops, something went wrong.