wireguard-dashboard/Dockerfile
2024-08-20 10:34:22 +08:00

31 lines
587 B
Docker

# 前后端集成打包
FROM golang:alpine as build
RUN apk add upx
WORKDIR /build
COPY . .
# sqlite必须
ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.cn,direct
RUN go build -ldflags="-s -w" -o wgui && upx -9 wgui
RUN ls -lh && chmod +x ./wgui
FROM alpine
RUN addgroup -S wgui && \
adduser -S -D -G wgui wgui
ENV GIN_MODE=release
RUN apk --no-cache add ca-certificates wireguard-tools jq iptables
WORKDIR /app
RUN mkdir -p db
COPY --from=build --chown=wgui:wgui /build/wgui /app
COPY --from=build /build/template/* /app/template/
RUN chmod +x wgui
ENTRYPOINT ["./wgui"]