generated from juanjiTech/jframe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (26 loc) · 1.01 KB
/
Dockerfile
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
# Stage 1: Build the Go application
FROM golang:latest AS builder
WORKDIR /build
COPY . .
RUN go mod tidy
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o App -ldflags "-s -w -extldflags '-static' -X 'github.com/GoldenSheep402/Hermes/conf.SysVersion=$(git show -s --format=%h)'" main.go
# Stage 2: Build the frontend using Node.js and pnpm
FROM node:latest AS frontend-builder
WORKDIR /frontend
COPY ./frontend .
RUN npm install -g pnpm \
&& pnpm install \
&& pnpm run build
FROM alpine:latest
WORKDIR /Serve
RUN apk update && apk add tzdata caddy supervisor \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone
#COPY config.yaml /Serve/config.yaml
#COPY Caddyfile /etc/caddy/Caddyfile
#
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY --from=builder /build/App /Serve/App
COPY --from=frontend-builder /frontend/dist /Serve/frontend
EXPOSE 8080
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]