-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
31 lines (24 loc) · 819 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
############################
# STEP 1 build executable binary
############################
FROM golang AS builder
RUN apt update -y \
&& apt install -y git make \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
COPY . .
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" .
RUN for p in $(ls pkg/crawler/sources | grep -v .so) ; do\
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \
-ldflags="-w -s" \
-buildmode=plugin \
-o pkg/crawler/sources/${p}.so \
pkg/crawler/sources/${p}/main.go;\
done
############################
# STEP 2 build a small image
############################
FROM golang
COPY --from=builder /build/proxymeister /proxymeister
COPY --from=builder /build/pkg/crawler/sources/*.so /
ENTRYPOINT ["/proxymeister"]