wireguard-dashboard/Dockerfile
coward 6d4f4b2e02
Some checks failed
continuous-integration/drone/tag Build is failing
🎨合并编译打包
2024-06-04 09:55:48 +08:00

44 lines
766 B
Docker

FROM node:18-alpine as build-stage
WORKDIR ./web-src
RUN corepack enable
RUN corepack prepare pnpm@8.6.10 --activate
RUN npm config set registry https://registry.npmmirror.com
COPY .npmrc package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm build
FROM golang:alpine as build
RUN apk add upx
WORKDIR /build
COPY ./web-src/dist ./web
COPY . .
# 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"]