wireguard-dashboard/Dockerfile
coward b9f153836d 🎨
2024-06-04 10:51:01 +08:00

43 lines
748 B
Docker

FROM node:18-alpine as build-stage
WORKDIR front
COPY ./web-src .
WORKDIR web-src
RUN ls -lh
RUN corepack enable
RUN corepack prepare pnpm@8.6.10 --activate
RUN npm config set registry https://registry.npmmirror.com
RUN pnpm install
RUN pnpm build
FROM golang:alpine as build
RUN apk add upx
WORKDIR /build
COPY . .
COPY --from=build-stage /front/web /web
# sqlite必须
ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.cn,direct
RUN go build -ldflags="-s -w" -o app && upx -9 app
RUN ls -lh && chmod +x ./app
FROM alpine
RUN apk --no-cache add ca-certificates wireguard-tools jq iptables
WORKDIR /app
RUN mkdir -p db
COPY --from=build /build/app /app
COPY --from=build /build/template/* /app/template/
RUN ls -al
ENTRYPOINT ["./app"]