forked from VaalaCat/frp-panel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.standalone
52 lines (45 loc) · 1.51 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
# Stage 1: Building frontend
FROM node:18-alpine AS frontend
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 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 && 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/out
COPY --from=frontend /app/out ./cmd/out
RUN CGO_ENABLED=0 GOPROXY=https://goproxy.cn,https://proxy.golang.org,direct go build -ldflags="-s -w" -o frp-panel cmd/*.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"]