Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use goreleaser to manage builds #151

Open
srikanthccv opened this issue Jun 24, 2023 · 2 comments
Open

use goreleaser to manage builds #151

srikanthccv opened this issue Jun 24, 2023 · 2 comments
Assignees

Comments

@srikanthccv
Copy link
Member

Find a unified and consistent way to manager binary and docker builds across the environments (which is not the case today)

@srikanthccv srikanthccv self-assigned this Jun 24, 2023
@svsk417
Copy link

svsk417 commented Aug 23, 2023

In the same area:
For better local reproducibility of the builds it would be nice to have a multi stage docker build instead of a build partly done in the actions through the makefile and partly done as docker image.
I am thinking of something like this:

# syntax=docker/dockerfile:1

# Build the application from source
FROM golang:1.21.0-alpine3.17 AS build-stage

WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download

RUN apk add build-base

COPY ./ ./

RUN CGO_ENABLED=1 go build -tags timetzdata -o .build/linux-amd64/signoz-collector -ldflags "-linkmode external -extldflags '-static' -s -w" ./cmd/signozcollector

# use a minimal alpine image
FROM alpine:3.17

# add ca-certificates in case you need them
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*

# define arguments and default values
ARG USER_UID=10001

# create a non-root user for running the collector
USER ${USER_UID}

# copy the binaries from the multi-stage build
COPY --from=build-stage /app/.build/linux-amd64/signoz-collector /signoz-collector

# copy the config and migration files
COPY config/default-config.yaml /etc/otel/config.yaml
COPY exporter/clickhousetracesexporter/migrations /migrations
COPY exporter/clickhouselogsexporter/migrations /logsmigrations

ENV LOG_MIGRATIONS_FOLDER="/logsmigrations"

# expose OTLP ports for the collector
EXPOSE 4317 4318

# run the binary as the entrypoint and pass the default config file as a flag
ENTRYPOINT [ "/signoz-collector" ]
CMD ["--config", "/etc/otel/config.yaml"]

@srikanthccv
Copy link
Member Author

See #152

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants