This commit is contained in:
20
Dockerfile
20
Dockerfile
@@ -1,9 +1,23 @@
|
||||
# 打包前端
|
||||
FROM node:18-alpine as build-front
|
||||
|
||||
WORKDIR front
|
||||
COPY . .
|
||||
WORKDIR web
|
||||
|
||||
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
|
||||
FROM golang:alpine as build-backend
|
||||
|
||||
RUN apk add upx
|
||||
WORKDIR /build
|
||||
COPY . .
|
||||
COPY --from=build-front /front/dist/ /build/dist
|
||||
# sqlite必须
|
||||
ENV GO111MODULE=on
|
||||
ENV GOPROXY=https://goproxy.cn,direct
|
||||
@@ -23,8 +37,8 @@ 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/
|
||||
COPY --from=build-backend --chown=wgui:wgui /build/wgui /app
|
||||
COPY --from=build-backend /build/template/* /app/template/
|
||||
|
||||
RUN chmod +x wgui
|
||||
|
||||
|
Reference in New Issue
Block a user