github.com/siglens/siglens@v0.0.0-20240328180423-f7ce9ae441ed/Dockerfile (about) 1 FROM golang:1.21-alpine3.18 AS build 2 WORKDIR /usr/app 3 COPY go.mod go.sum ./ 4 RUN go mod download 5 COPY . . 6 7 ENV CGO_ENABLED=1 8 ARG TARGETOS TARGETARCH 9 10 RUN echo 'https://dl-cdn.alpinelinux.org/alpine/v3.13/main' >> /etc/apk/repositories 11 RUN apk add gcc musl-dev libc-dev make && \ 12 cd /usr/app/cmd/siglens && \ 13 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags "-X 'github.com/siglens/siglens/pkg/config/config.Version=${VERSION}'" -o build/siglens 14 15 FROM golang:1.21-alpine3.18 16 RUN apk add shadow 17 RUN apk add curl 18 19 ARG UNAME=siglens 20 ARG UID=1000 21 ARG GID=1000 22 RUN groupadd -g $GID -o $UNAME 23 RUN useradd -m -u $UID -g $GID -o $UNAME 24 25 WORKDIR /$UNAME 26 COPY static static 27 COPY server.yaml . 28 COPY defaultDBs defaultDBs 29 30 RUN chown -R $UNAME:$GID static 31 RUN chown -R $UNAME:$GID /siglens 32 RUN chown -R $UNAME:$GID defaultDBs 33 USER $UNAME 34 35 WORKDIR /$UNAME 36 COPY --from=build /usr/app/cmd/siglens/build/siglens . 37 38 USER root 39 RUN chown $UNAME:$GID siglens 40 41 USER $UNAME 42 CMD ["./siglens", "--config", "server.yaml"]