mirror of
https://github.com/VaalaCat/frp-panel.git
synced 2025-12-24 11:51:06 +08:00
52 lines
1.6 KiB
Docker
52 lines
1.6 KiB
Docker
# Stage 1: Building frontend
|
|
FROM node:18-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 npm install
|
|
|
|
COPY www/api/ ./api
|
|
COPY www/components/ ./components
|
|
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 && npm run build
|
|
|
|
# Stage 2: Building binary
|
|
FROM golang:1.21-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
|
|
COPY go.mod go.sum ./
|
|
RUN CGO_ENABLED=0 GOPROXY=https://goproxy.cn,https://proxy.golang.org,direct go mod download
|
|
COPY . .
|
|
RUN rm -rf /app/cmd/frpp/out
|
|
COPY --from=frontend /app/www/out ./cmd/frpp/out
|
|
RUN CGO_ENABLED=0 GOPROXY=https://goproxy.cn,https://proxy.golang.org,direct go build -ldflags="-s -w" -o frp-panel cmd/frpp/*.go
|
|
|
|
# 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
|
|
ENTRYPOINT ["/app/frp-panel"]
|
|
CMD ["master"] |