部署准备
This commit is contained in:
1 parent
a82a843b76
commit
1c495d3ae0
3 files changed
+140
-5
No files matched your search
+3
-5
@@ -4,19 +4,17 @@ ENV GOPRIVATE=git.vitatech.com.cn
|
||||
RUN git config --global url."ssh://git@git.vitatech.com.cn:12222/".insteadOf "https://git.vitatech.com.cn/" \
|
||||
&& mkdir -p -m 0700 /root/.ssh
|
||||
WORKDIR /src
|
||||
COPY gin_layout/go.mod gin_layout/go.sum ./gin_layout/
|
||||
WORKDIR /src/gin_layout
|
||||
COPY go.mod go.sum ./
|
||||
RUN --mount=type=ssh,required=true \
|
||||
--mount=type=secret,id=git_known_hosts,target=/root/.ssh/known_hosts,required=true \
|
||||
go mod download
|
||||
COPY gin_layout /src/gin_layout
|
||||
RUN CGO_ENABLED=0 go build -trimpath -o /out/api ./cmd/api
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 go build -mod=readonly -trimpath -o /out/api ./cmd/api
|
||||
|
||||
FROM alpine:3.23
|
||||
RUN apk add --no-cache ca-certificates tzdata
|
||||
WORKDIR /app
|
||||
COPY --from=builder /out/api ./api
|
||||
COPY gin_layout/configs/config.yaml ./configs/config.yaml
|
||||
USER 65532:65532
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["./api"]
|
||||
Reference in new issue
Block a user