forked from zilliztech/milvus-backup
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: refine image building (zilliztech#352)
Signed-off-by: zhuwenxing <[email protected]>
- Loading branch information
1 parent
93f9ae0
commit 9ccbc27
Showing
6 changed files
with
68 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
|
||
FROM golang:1.18 AS builder | ||
|
||
ENV CGO_ENABLED=0 | ||
|
||
ARG VERSION=0.0.1 | ||
ARG COMMIT=unknown | ||
ARG DATE=unknown | ||
|
||
WORKDIR /app | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
COPY . . | ||
RUN go mod tidy | ||
RUN go build -ldflags="-s -w" -o /app/milvus-backup | ||
RUN wget -P /app https://dl.min.io/client/mc/release/linux-amd64/mc | ||
RUN chmod +x /app/mc | ||
RUN go build -ldflags="-X 'main.version=$VERSION' -X 'main.commit=$COMMIT' -X 'main.date=$DATE'" -o /app/milvus-backup | ||
|
||
FROM alpine:3.17 | ||
|
||
WORKDIR /app | ||
RUN apk add --no-cache curl | ||
|
||
COPY --from=builder /app/milvus-backup . | ||
COPY --from=builder /app/configs ./configs | ||
COPY --from=builder /app/mc . | ||
EXPOSE 8080 | ||
ENTRYPOINT ["/app/milvus-backup", "server"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: '3.5' | ||
|
||
services: | ||
milvus-backup: | ||
container_name: milvus-backup | ||
image: milvusdb/milvus-backup:latest | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://localhost:8080/api/v1/hello"] | ||
interval: 60s | ||
timeout: 10s | ||
retries: 3 | ||
network_mode: "host" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
VERSION=$(git describe --tags --always) | ||
COMMIT=$(git rev-parse --short HEAD) | ||
DATA=$(date +'%Y-%m-%dT%H:%M:%S') | ||
|
||
docker build -t milvusdb/milvus-backup:$VERSION --build-arg VERSION=$VERSION --build-arg COMMIT=$COMMIT --build-arg DATA=$DATA . | ||
docker tag milvusdb/milvus-backup:$VERSION milvusdb/milvus-backup:latest |