From 17160e38cffb3dd21ffbec0cdc58154442dc2457 Mon Sep 17 00:00:00 2001 From: Aire-One Date: Mon, 23 Sep 2024 03:54:23 +0200 Subject: [PATCH] fix: docker build --- .dockerignore | 7 +++++++ Dockerfile | 10 +++++----- configs/example-stack/README.md | 1 + compose.yml => configs/example-stack/compose.yaml | 6 +++--- .../example-stack/prometheus-data/prometheus.yaml | 0 5 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 .dockerignore create mode 100644 configs/example-stack/README.md rename compose.yml => configs/example-stack/compose.yaml (60%) rename prometheus.yml => configs/example-stack/prometheus-data/prometheus.yaml (100%) diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..92da7f2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +.vscode +.woodpecker + +configs + +.* +renovate.json diff --git a/Dockerfile b/Dockerfile index 37fb561..96ebac8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,11 @@ FROM golang:1.23.1 AS builder WORKDIR /app -COPY go.mod go.sum main.go ./ +COPY go.mod go.sum ./ RUN go mod download -RUN go build + +COPY . . +RUN go build -o labtime cmd/labtime/main.go FROM gcr.io/distroless/base-debian12 @@ -14,12 +16,10 @@ 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 +ENTRYPOINT ["/labtime"] diff --git a/configs/example-stack/README.md b/configs/example-stack/README.md new file mode 100644 index 0000000..d5b31c2 --- /dev/null +++ b/configs/example-stack/README.md @@ -0,0 +1 @@ +This is a docker compose stack example to run Prometheus with Grafana to play with the Labtime metrics. diff --git a/compose.yml b/configs/example-stack/compose.yaml similarity index 60% rename from compose.yml rename to configs/example-stack/compose.yaml index d7e315b..89ceb2f 100644 --- a/compose.yml +++ b/configs/example-stack/compose.yaml @@ -5,12 +5,12 @@ services: ports: - 9090:9090 volumes: - - ./prometheus.yml:/etc/prometheus/prometheus.yml + - prometheus-data/prometheus.yaml:/etc/prometheus/prometheus.yaml command: - - '--config.file=/etc/prometheus/prometheus.yml' + - '--config.file=/etc/prometheus/prometheus.yaml' extra_hosts: - "host.docker.internal:host-gateway" grafana: image: grafana/grafana ports: - - 3000:3000 \ No newline at end of file + - 3000:3000 diff --git a/prometheus.yml b/configs/example-stack/prometheus-data/prometheus.yaml similarity index 100% rename from prometheus.yml rename to configs/example-stack/prometheus-data/prometheus.yaml