From d3e7d3f30d787d891872dc2c35d2827af03414e8 Mon Sep 17 00:00:00 2001 From: Ryan D McGuire Date: Sat, 4 Jan 2025 21:11:11 -0500 Subject: [PATCH] Add docker --- Dockerfile | 23 +++++++++++++++++++++++ docker-compose.yml | 17 +++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..abd9a69 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM golang:1-alpine AS build +WORKDIR /app + +ENV GO111MODULE=auto CGO_ENABLED=0 GOOS=linux + +ARG GOPROXY +ARG GONOSUMDB=gitea.libretechconsulting.com +ARG VERSIONPATH=gitea.libretechconsulting.com/rmcguire/go-app/pkg/config.Version +ARG VERSION=(devel) + +COPY ./go.mod ./go.sum ./ +RUN go mod download + +COPY ./ /app +RUN go build -C . -v -ldflags "-extldflags '-static' -X ${VERSIONPATH}=${VERSION}" -o ambient-local-exporter . + +FROM alpine:latest +WORKDIR /app +USER 100:101 + +COPY --from=build --chown=100:101 /app/ambient-local-exporter /app/ + +ENTRYPOINT [ "/app/ambient-local-exporter" ] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c757e5a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +name: Ambient Local Exporter +services: + ambient-local-exporter: + image: image.libretechconsulting.com/dev/ambient-local-exporter:latest + ports: + - 8080:8080 + environment: + APP_NAME: ambient-local-exporter + APP_LOG_LEVEL: debug ## For testing only + APP_LOG_FORMAT: json ## console, json + APP_LOG_TIME_FORMAT: rfc3339 ## long, short, unix, rfc3339, off + APP_HTTP_LISTEN: 0.0.0.0:8080 + APP_OTEL_STDOUT_ENABLED: false + APP_OTEL_METRIC_INTERVAL_SECS: 30 + OTEL_EXPORTER_OTLP_ENDPOINT: http://otel.libretechconsulting.com:4317 # Set to your otel collector + OTEL_SERVICE_NAME: ambient-local-exporter + OTEL_RESOURCE_ATTRIBUTES: "env=development,service.version=(devel)"