Skip to content

when deploying a Turbine application, we should rely on local go version creating the dockerfile #838

Description

@raulb

Describe the bug

In https://github.com/meroxa/cli/blob/main/cmd/meroxa/turbine/golang/templates/Dockerfile.tpl#L1C16-L1C25, we rely on the go version specified in https://github.com/meroxa/cli/blob/main/cmd/meroxa/turbine/golang/deploy.go#L29. If the go version doesn't match user's local go version, building the image through apps deploy will fail:

[2023-10-25T08:44:52Z]	"#11 [builder 4/4] RUN go build -tags server -o app-name ./...\n"
[2023-10-25T08:44:58Z]	"#11 6.377 go: errors parsing go.mod:\n"
[2023-10-25T08:44:58Z]	"#11 6.377 /builder/go.mod:3: invalid go version '1.21.0': must match format 1.23\n"
[2023-10-25T08:44:58Z]	"#11 ERROR: process \"/bin/sh -c go build -tags server -o app-name ./...\" did not complete successfully: exit code: 1\n"
[2023-10-25T08:44:58Z]	"------\n"
[2023-10-25T08:44:58Z]	" > [builder 4/4] RUN go build -tags server -o app-name ./...:\n"
[2023-10-25T08:44:58Z]	"6.377 go: errors parsing go.mod:\n"
[2023-10-25T08:44:58Z]	"6.377 /builder/go.mod:3: invalid go version '1.21.0': must match format 1.23\n"
[2023-10-25T08:44:58Z]	"------\n"
[2023-10-25T08:44:58Z]	"Dockerfile:5\n"
[2023-10-25T08:44:58Z]	"--------------------\n"
[2023-10-25T08:44:58Z]	"   3 |     COPY . .\n"
[2023-10-25T08:44:58Z]	"   4 |     ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64\n"
[2023-10-25T08:44:58Z]	"   5 | >>> RUN go build -tags server -o app-name ./...\n"
[2023-10-25T08:44:58Z]	"   6 |     \n"
[2023-10-25T08:44:58Z]	"   7 |     FROM [gcr.io/distroless/static](http://gcr.io/distroless/static)\n"
[2023-10-25T08:44:58Z]	"--------------------\n"
[2023-10-25T08:44:58Z]	"error: failed to solve: process \"/bin/sh -c go build -tags server -o app-name ./...\" did not complete successfully: exit code: 1\n"

To Reproduce

What can we do to reproduce your bug?

Try to deploy an app using a different go version than the one we've got in CLI.

Expected behavior

We fetch local go version and use that one instead of a hardcoded one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions