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