Optimize image

This commit is contained in:
OopsUnix committed 2025-02-19 21:09:15 +08:00
1 parent 27186e082f
commit a961acb926
3 files changed
+19 -9

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
.git
.idea
.cache
.vscode
+11 -4
View File
@@ -1,9 +1,16 @@
FROM golang:1.23.2
FROM golang:1.23.2 AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go get -d -v ./
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o ghproxy .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o ghproxy -ldflags="-s -w" .
FROM alpine:latest
RUN apk --no-cache add ca-certificates curl grep
ENV TZ=Asia/Shanghai
WORKDIR /app
COPY --from=builder /app/ghproxy /app/ghproxy
COPY --from=builder /app/public /app/public
COPY --from=builder /app/config.json /app/config.json
EXPOSE 45000
CMD ["./ghproxy"]
ENTRYPOINT ["/app/ghproxy"]
+4 -5
View File
@@ -1,12 +1,11 @@
version: '3.8'
services:
mirrors:
image: registry.cn-hangzhou.aliyuncs.com/oopsunix/ghproxy:latest
# image: oopsunix/ghproxy:latest
ghproxy:
image: oopsunix/ghproxy:latest
# image:ghcr.io/oopsunix/ghproxy:latest
# image: registry.cn-hangzhou.aliyuncs.com/oopsunix/ghproxy:latest
container_name: ghproxy
restart: unless-stopped
volumes:
- ./config.json:/app/config.json
- ./data:/app
network_mode: host