-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathDockerfile.standalone
56 lines (49 loc) · 1.67 KB
/
Dockerfile.standalone
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# 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
ENTRYPOINT ["/app/frp-panel"]
CMD ["master"]