Add docker

This commit is contained in:
Ryan McGuire 2025-01-04 21:11:11 -05:00
parent 59b598c6b3
commit d3e7d3f30d
2 changed files with 40 additions and 0 deletions

23
Dockerfile Normal file
View File

@ -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" ]

17
docker-compose.yml Normal file
View File

@ -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)"