2024-06-04 09:55:48 +08:00
|
|
|
FROM node:18-alpine as build-stage
|
|
|
|
|
2024-06-04 10:16:51 +08:00
|
|
|
WORKDIR front
|
2024-06-04 10:45:38 +08:00
|
|
|
COPY ./web-src .
|
2024-06-04 10:16:51 +08:00
|
|
|
WORKDIR web-src
|
|
|
|
|
|
|
|
RUN ls -lh
|
2024-06-04 09:55:48 +08:00
|
|
|
RUN corepack enable
|
|
|
|
RUN corepack prepare pnpm@8.6.10 --activate
|
|
|
|
RUN npm config set registry https://registry.npmmirror.com
|
2024-06-04 10:45:38 +08:00
|
|
|
RUN pnpm install
|
2024-06-04 09:55:48 +08:00
|
|
|
|
2024-06-04 11:13:43 +08:00
|
|
|
RUN pnpm build && \
|
|
|
|
ls -al
|
2024-06-04 09:55:48 +08:00
|
|
|
|
2024-05-08 14:21:49 +08:00
|
|
|
FROM golang:alpine as build
|
|
|
|
|
2024-05-08 17:21:52 +08:00
|
|
|
RUN apk add upx
|
2024-05-08 14:33:40 +08:00
|
|
|
|
2024-05-08 14:21:49 +08:00
|
|
|
WORKDIR /build
|
|
|
|
|
|
|
|
COPY . .
|
2024-06-04 11:04:20 +08:00
|
|
|
COPY --from=build-stage /front/web/* /web
|
2024-05-08 16:20:52 +08:00
|
|
|
# sqlite必须
|
2024-05-08 14:21:49 +08:00
|
|
|
ENV GO111MODULE=on
|
|
|
|
ENV GOPROXY=https://goproxy.cn,direct
|
|
|
|
|
2024-05-09 08:48:32 +08:00
|
|
|
RUN go build -ldflags="-s -w" -o app && upx -9 app
|
2024-05-08 14:21:49 +08:00
|
|
|
|
|
|
|
RUN ls -lh && chmod +x ./app
|
|
|
|
|
|
|
|
FROM alpine
|
|
|
|
|
2024-05-09 11:49:26 +08:00
|
|
|
RUN apk --no-cache add ca-certificates wireguard-tools jq iptables
|
|
|
|
|
2024-05-08 14:59:40 +08:00
|
|
|
WORKDIR /app
|
2024-05-08 15:51:19 +08:00
|
|
|
RUN mkdir -p db
|
2024-05-08 14:21:49 +08:00
|
|
|
|
2024-05-08 14:59:40 +08:00
|
|
|
COPY --from=build /build/app /app
|
|
|
|
COPY --from=build /build/template/* /app/template/
|
2024-05-08 14:21:49 +08:00
|
|
|
|
2024-05-08 16:20:52 +08:00
|
|
|
RUN ls -al
|
2024-05-08 14:59:40 +08:00
|
|
|
|
2024-05-08 15:51:19 +08:00
|
|
|
ENTRYPOINT ["./app"]
|