diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml new file mode 100644 index 0000000..e2d8ad3 --- /dev/null +++ b/.woodpecker/build.yaml @@ -0,0 +1,20 @@ +--- +when: + branch: main + path: + - Dockerfile + - .woodpecker/build.yaml + +variables: + - &buildx woodpeckerci/plugin-docker-buildx:4.2.0 + - &buildx_settings + platforms: linux/amd64 + +steps: + dryrun: + image: *buildx + settings: + <<: *buildx_settings + dry_run: true + when: + event: pull_request \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..146b69c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +# syntax=docker/dockerfile:1 + +FROM golang:1.22.4 AS builder + +WORKDIR /app + +COPY go.mod go.sum main.go ./ +RUN go mod download +RUN go build + +FROM gcr.io/distroless/base-debian12 + +WORKDIR / + +COPY --from=builder /app/labtime /labtime + +# This is the port currently hardcoded in the application +EXPOSE 2112 + +# For now the config file path/name are hardcoded in the application +VOLUME ["/config"] + +USER nonroot:nonroot + +ENTRYPOINT ["/labtime"] \ No newline at end of file diff --git a/config.yaml b/config/config.yaml similarity index 100% rename from config.yaml rename to config/config.yaml diff --git a/main.go b/main.go index 324b750..531579c 100644 --- a/main.go +++ b/main.go @@ -89,7 +89,8 @@ func Ping(url string) (int, time.Duration, error) { func main() { // Load config - config, err := NewConfig("config.yaml") + // TODO: Use a flag to specify the config file + config, err := NewConfig("config/config.yaml") if err != nil { log.Fatalf("Error loading config: %s", err) }