-
Notifications
You must be signed in to change notification settings - Fork 117
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
1 parent
2df5fb6
commit aa24f2a
Showing
5 changed files
with
108 additions
and
36 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,31 @@ | ||
# Include any files or directories that you don't want to be copied to your | ||
# container here (e.g., local build artifacts, temporary files, etc.). | ||
# | ||
# For more help, visit the .dockerignore file reference guide at | ||
# https://docs.docker.com/go/build-context-dockerignore/ | ||
|
||
**/.DS_Store | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/compose.y*ml | ||
**/Dockerfile* | ||
.github | ||
LICENSE.md | ||
README.md | ||
SECURITY.md | ||
Makefile | ||
supercronic |
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,17 +22,21 @@ jobs: | |
|
||
- name: Setup Bats and bats libs | ||
id: setup-bats | ||
uses: bats-core/bats-action@3 | ||
uses: bats-core/[email protected] | ||
|
||
- name: install govulncheck | ||
run: | | ||
go install golang.org/x/vuln/cmd/govulncheck@latest | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: run tests | ||
run: make test | ||
env: | ||
-BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }} | ||
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }} | ||
- name: run vuln check | ||
run: make vulncheck |
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,48 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Create a stage for building the application. | ||
ARG GO_VERSION=1.23.2 | ||
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} AS build | ||
WORKDIR /src | ||
|
||
RUN --mount=type=cache,target=/go/pkg/mod/ \ | ||
--mount=type=bind,source=go.sum,target=go.sum \ | ||
--mount=type=bind,source=go.mod,target=go.mod \ | ||
go mod download -x | ||
|
||
# This is the architecture you're building for, which is passed in by the builder. | ||
# Placing it here allows the previous steps to be cached across architectures. | ||
ARG TARGETARCH | ||
ARG VERSION="<unset>" | ||
|
||
RUN --mount=type=cache,target=/go/pkg/mod/ \ | ||
--mount=type=bind,target=. \ | ||
CGO_ENABLED=0 GOARCH=$TARGETARCH \ | ||
go build -ldflags "-X main.Version=${VERSION}" \ | ||
-o /bin/supercronic . | ||
|
||
################################################################################ | ||
FROM alpine:latest AS final | ||
|
||
RUN --mount=type=cache,target=/var/cache/apk \ | ||
apk --update add \ | ||
ca-certificates \ | ||
tzdata \ | ||
&& \ | ||
update-ca-certificates | ||
|
||
# Create a non-privileged user that the app will run under. | ||
# See https://docs.docker.com/go/dockerfile-user-best-practices/ | ||
ARG UID=10001 | ||
RUN adduser \ | ||
--disabled-password \ | ||
--gecos "" \ | ||
--system \ | ||
--no-create-home \ | ||
--uid "${UID}" \ | ||
supercronic | ||
USER supercronic | ||
|
||
COPY --from=build /bin/supercronic /bin/ | ||
|
||
ENTRYPOINT [ "/bin/supercronic" ] |
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