-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
Dockerfile
33 lines (23 loc) · 966 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
# We use the -alpine build image to build Nebula agains musl because we need
# CGO to be enabled and I'd like use an alpine base image for the final image.
FROM golang:1.23-alpine AS builder
# Switch to an isolated build directory
WORKDIR /build
# For caching, only copy the dependency-defining files and download depdencies
COPY go.mod go.sum ./
RUN go mod download
# Install build dependencies
RUN apk add --no-cache gcc musl-dev
# Copy everything else minus everything that's in .dockerignore
COPY . ./
# Finally build Nebula
RUN CGO_ENABLED=1 GOOS=linux go build -ldflags "-X main.RawVersion=`cat version`" -o nebula github.com/dennis-tra/nebula-crawler/cmd/nebula
# Create lightweight container to run nebula
FROM alpine:latest
# Create user nebula
RUN adduser -D -H nebula
WORKDIR /home/nebula
USER nebula
COPY --from=builder /build/nebula /usr/local/bin/nebula
HEALTHCHECK --interval=15s --timeout=5s --start-period=10s CMD nebula health
CMD nebula