-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
55 lines (40 loc) · 1.11 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
FROM golang:1.19-alpine AS builder
ENV CGO_ENABLED=1 GOOS=linux
RUN apk add --no-cache \
libpcap-dev \
g++ \
perl-utils \
curl \
build-base \
binutils-gold \
bash \
clang \
llvm \
libbpf-dev \
linux-headers
ARG COMMIT_HASH=NOT_SET
ARG GIT_BRANCH=NOT_SET
ARG BUILD_TIMESTAMP=NOT_SET
ARG NEXT_VERSION=NOT_SET
ARG GITUSER
ARG GITPAT
RUN go env -w GOPRIVATE=github.com/mogenius
RUN apk add git
RUN git config --global url."https://$GITUSER:$GITPAT@github.com".insteadOf "https://github.com"
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="-extldflags= \
-X 'podloxx/version.GitCommitHash=${COMMIT_HASH}' \
-X 'podloxx/version.Branch=${GIT_BRANCH}' \
-X 'podloxx/version.BuildTimestamp=${BUILD_TIMESTAMP}' \
-X 'podloxx/version.Ver=${NEXT_VERSION}'" -o bin/podloxx .
FROM alpine:latest
RUN apk add --no-cache \
libpcap-dev bash
WORKDIR /app
COPY --from=builder ["/app/bin/podloxx", "."]
COPY --from=builder ["/app/.env", "/app/.env"]
ENV GIN_MODE=release
ENTRYPOINT [ "/app/podloxx", "cluster" ]