diff --git a/main.go b/main.go index b7f91ca..a3f513a 100644 --- a/main.go +++ b/main.go @@ -11,7 +11,13 @@ import ( func main() { app := gofr.NewCMD() - app.AddHTTPService("deployment-service", "https://api.stage.kops.dev") + zopAPI := "http://localhost:9005" + + if app.Config.Get("DEP_ENV") == "PRODUCTION" { + zopAPI = "https://api.kops.dev" + } + + app.AddHTTPService("deployment-service", zopAPI) dClient := depClient.New() depSvc := deploySvc.New(dClient) diff --git a/service/deploy/templates.go b/service/deploy/templates.go index 2e379fe..092155c 100644 --- a/service/deploy/templates.go +++ b/service/deploy/templates.go @@ -1,11 +1,24 @@ package deploy const ( - Golang = `FROM alpine:latest -RUN apk add --no-cache tzdata ca-certificates -COPY main ./main -RUN chmod +x /main -EXPOSE {{ . }} + Golang = `FROM golang:1.22 AS builder + +WORKDIR /app + +COPY . . + +RUN go mod tidy + +RUN GOOS=linux GOARCH=amd64 go build -o main + +FROM alpine:3.15 + +COPY --from=builder /app / + +RUN chmod 777 /main + +EXPOSE 9000 + CMD ["/main"]` Js = `FROM node:10-alpine