feat: Dockerfile remove config

This commit is contained in:
zzw
2026-08-21 10:49:12 +08:00
parent f360c268be
commit a2492a346e
20 changed files with 254 additions and 112 deletions
+9 -8
View File
@@ -1,5 +1,3 @@
# syntax=docker/dockerfile:1
FROM golang:1.26.5-alpine AS builder
WORKDIR /src
@@ -10,16 +8,19 @@ ENV GOPROXY=https://goproxy.cn,direct \
GOARCH=amd64
COPY pkg ./pkg
COPY product/go.mod product/go.sum ./product/
COPY go.mod go.sum ./
WORKDIR /src/product
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
COPY product/ ./
COPY rpc/product/ ./rpc/product/
COPY services/product/ ./services/product/
WORKDIR /src/services/product
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go build -ldflags="-s -w" -o /out/product .
go build -ldflags="-s -w" -o /out/main ./
FROM alpine:3.22
@@ -31,8 +32,8 @@ RUN apk add --no-cache tzdata \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone
COPY --from=builder /out/product .
COPY --from=builder /out/main .
EXPOSE 10100
CMD ["./product", "-f", "etc/product.yaml"]
CMD ["./main", "-f", "etc/product.yaml"]