mirror of
https://github.com/VaalaCat/frp-panel.git
synced 2025-09-26 19:31:18 +08:00
56 lines
1.7 KiB
Docker
56 lines
1.7 KiB
Docker
# Stage 1: Building frontend
|
|
FROM node:20-alpine AS frontend
|
|
WORKDIR /app/www
|
|
# RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
|
|
RUN apk update --no-cache && apk add --no-cache tzdata git openssh
|
|
# RUN npm config set registry https://registry.npmmirror.com
|
|
COPY www/package*.json .
|
|
RUN corepack enable && corepack prepare pnpm@latest-9 --activate && pnpm install
|
|
|
|
COPY www/api/ ./api
|
|
COPY www/components/ ./components
|
|
COPY www/config/ ./config
|
|
COPY www/hooks/ ./hooks
|
|
COPY www/i18n/ ./i18n
|
|
COPY www/lib/ ./lib
|
|
COPY www/pages/ ./pages
|
|
COPY www/public/ ./public
|
|
COPY www/store/ ./store
|
|
COPY www/styles/ ./styles
|
|
COPY www/types/ ./types
|
|
|
|
COPY www/*.js ./
|
|
COPY www/*.ts ./
|
|
COPY www/*.yaml ./
|
|
COPY www/*.json ./
|
|
|
|
RUN ls && mkdir -p ../cmd/frpp && pnpm build
|
|
|
|
# Stage 2: Building binary
|
|
FROM golang:1.22-alpine AS builder
|
|
WORKDIR /app
|
|
# RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
|
|
RUN apk update --no-cache && apk add --no-cache tzdata git bash
|
|
COPY go.mod go.sum ./
|
|
# RUN CGO_ENABLED=0 GOPROXY=https://goproxy.cn,https://proxy.golang.org,direct go mod download
|
|
RUN CGO_ENABLED=0 go mod download
|
|
COPY . .
|
|
RUN rm -rf /app/cmd/frpp/out
|
|
COPY --from=frontend /app/www/out ./cmd/frpp/out
|
|
RUN rm -rf /app/dist/frp* && ./build.sh --skip-frontend --current
|
|
|
|
# Stage 3: Build image
|
|
FROM alpine:latest
|
|
WORKDIR /app
|
|
# RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
|
|
RUN apk update --no-cache && apk add --no-cache tzdata git && mkdir -p /data
|
|
COPY --from=builder /app/frp-panel .
|
|
|
|
# web port
|
|
EXPOSE 9000
|
|
# rpc port
|
|
EXPOSE 9001
|
|
|
|
ENV DB_DSN=/data/data.db?_pragma=journal_mode(WAL)
|
|
ENTRYPOINT ["/app/frp-panel"]
|
|
CMD ["master"] |