rr1 commited on
Commit
af676b0
·
verified ·
1 Parent(s): 86d8b4a

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -0
Dockerfile ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 使用适合Go应用的基础镜像
2
+ FROM golang:alpine AS builder
3
+ ARG TARGETOS
4
+ ARG TARGETARCH
5
+ RUN apk update && apk add --no-cache upx make git && rm -rf /var/cache/apk/*
6
+ RUN git clone https://github.com/ycvk/monica-proxy.git /app
7
+
8
+ # 设置工作目录
9
+ WORKDIR /app
10
+
11
+ # 下载依赖
12
+ RUN go mod tidy
13
+
14
+ # 构建应用程序
15
+ RUN make build-${TARGETOS}-${TARGETARCH}
16
+
17
+ FROM scratch AS final
18
+ WORKDIR /data
19
+ COPY --from=builder /app/build/monica /data/monica
20
+
21
+ # 开放端口
22
+ EXPOSE 8080
23
+
24
+ # 运行
25
+ CMD ["./monica"]