31 lines
1.0 KiB
Plaintext
31 lines
1.0 KiB
Plaintext
|
# syntax=docker/dockerfile:1.4
|
||
|
|
||
|
FROM golang:1.19.5-alpine3.16 as builder
|
||
|
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \
|
||
|
&& go env -w GONOSUMDB=lab.threathunter.cn \
|
||
|
&& go env -w GOPROXY=goproxy.threathunter.cn
|
||
|
|
||
|
WORKDIR /build
|
||
|
COPY --link . .
|
||
|
|
||
|
RUN --mount=type=cache,id=golang-1.19.5-alpine.3.16/var/cache/apk,target=/var/cache/apk \
|
||
|
apk add gcc g++ su-exec tzdata bash busybox tree libpcap-dev
|
||
|
|
||
|
RUN --mount=type=cache,id=golang-1.19.5-alpine3.16/go/pkg/mod,target=/go/pkg/mod \
|
||
|
--mount=type=cache,id=golang-1.19.5-alpine3.16/root/.cache,target=/root/.cache \
|
||
|
go mod download
|
||
|
|
||
|
RUN --mount=type=cache,id=golang-1.19.5-alpine3.16/go/pkg/mod,target=/go/pkg/mod \
|
||
|
--mount=type=cache,id=golang-1.19.5-alpine3.16/root/.cache,target=/root/.cache \
|
||
|
CGO_ENABLED=1 go build -a -ldflags '-w -s' -o /packet-ui
|
||
|
|
||
|
COPY --link ./deploy/sys-root /
|
||
|
|
||
|
RUN chmod +x /docker-entrypoint.sh /docker-cmd.sh
|
||
|
|
||
|
VOLUME [ "/app/data", "/app/conf", "/app/logs" ]
|
||
|
|
||
|
|
||
|
EXPOSE 20028
|
||
|
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
||
|
CMD [ "/docker-cmd.sh" ]
|