Răsfoiți Sursa

feat: add goctl docker build scripts (#1760)

Kevin Wan 3 ani în urmă
părinte
comite
8694e38384
2 a modificat fișierele cu 13 adăugiri și 3 ștergeri
  1. 3 3
      tools/goctl/Dockerfile
  2. 10 0
      tools/goctl/Makefile

+ 3 - 3
tools/goctl/Dockerfile

@@ -18,7 +18,7 @@ COPY . .
 RUN go build -ldflags="-s -w" -o /app/goctl ./goctl.go
 
 
-FROM alpine
+FROM golang:alpine
 
 RUN apk update --no-cache && apk add --no-cache protoc
 
@@ -29,6 +29,6 @@ COPY --from=builder /go/bin/protoc-gen-go-grpc /usr/bin/protoc-gen-go-grpc
 ENV TZ Asia/Shanghai
 
 WORKDIR /app
-COPY --from=builder /app/goctl /app/goctl
+COPY --from=builder /app/goctl /usr/bin/goctl
 
-CMD ["./goctl"]
+CMD ["goctl"]

+ 10 - 0
tools/goctl/Makefile

@@ -10,3 +10,13 @@ win:
 linux:
 	GOOS=linux go build -ldflags="-s -w" -o goctl-linux goctl.go
 	$(if $(shell command -v upx), upx goctl-linux)
+
+image:
+	docker build --rm --platform linux/amd64 -t kevinwan/goctl:$(version) .
+	docker tag kevinwan/goctl:$(version) kevinwan/goctl:latest
+	docker push kevinwan/goctl:$(version)
+	docker push kevinwan/goctl:latest
+	docker build --rm --platform linux/arm64 -t kevinwan/goctl:$(version)-arm64 .
+	docker tag kevinwan/goctl:$(version)-arm64 kevinwan/goctl:latest-arm64
+	docker push kevinwan/goctl:$(version)-arm64
+	docker push kevinwan/goctl:latest-arm64