From f768ba52091e96b8aab2f16e7057fa944c22b67c Mon Sep 17 00:00:00 2001 From: Jack Kawell Date: Fri, 2 Aug 2024 22:41:26 -0500 Subject: [PATCH] fix: api changes (#30) Changes: - updated buf in api/Dockerfile - actually enabled api build using custom image --- api/Dockerfile | 2 +- tools/dctl/cmd/api/build.go | 10 +++++++++- tools/dctl/cmd/api/init.go | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/api/Dockerfile b/api/Dockerfile index 4392c20..9d7c66d 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -3,7 +3,7 @@ FROM golang:1.21-alpine RUN apk add --update --no-cache npm # install buf -RUN go install github.com/bufbuild/buf/cmd/buf@v1.33.0 +RUN go install github.com/bufbuild/buf/cmd/buf@v1.35.1 # install protoc plugins diff --git a/tools/dctl/cmd/api/build.go b/tools/dctl/cmd/api/build.go index d435d7e..f959396 100644 --- a/tools/dctl/cmd/api/build.go +++ b/tools/dctl/cmd/api/build.go @@ -25,6 +25,14 @@ func Build(cmd *cobra.Command, args []string) (err error) { return nil } + var image string + if ImageName != "" { + image = ImageName + output.Print("Using image: %s", image) + } else { + image = dctx.API.ImageName + } + // build out execution path rootPath := dctx.Root apiPath := filepath.Join(rootPath, "api") @@ -34,7 +42,7 @@ func Build(cmd *cobra.Command, args []string) (err error) { // base configuration for docker container runs config := &container.Config{ - Image: dctx.API.ImageName, + Image: image, WorkingDir: "/workspace", } hostConfig := &container.HostConfig{ diff --git a/tools/dctl/cmd/api/init.go b/tools/dctl/cmd/api/init.go index 78b57b7..86090cc 100644 --- a/tools/dctl/cmd/api/init.go +++ b/tools/dctl/cmd/api/init.go @@ -15,8 +15,8 @@ import ( ) var ( - BuildImage bool - ImageName string + BuildImage bool + ImageName string ) func Init(cmd *cobra.Command, args []string) error {