-
Notifications
You must be signed in to change notification settings - Fork 138
Open
Description
Related to an existing integration?
Yes
Existing integration
CommunityToolkit.Aspire.Hosting.Golang
Overview
Aspire 13 allows to define how dockerfile should be generated for certain resources:
.PublishAsDockerFile(publish =>
{
publish.WithDockerfileBuilder("/path/to/app", context =>
{
var buildStage = context.Builder
.From("golang:1.23", "builder")
.WorkDir("/build")
.Copy(".", "./")
.Run("go build -o /app/server .");
context.Builder
.From("alpine:latest")
.CopyFrom(buildStage.StageName!, "/app/server", "/app/server")
.Entrypoint(["/app/server"]);
});documented here: https://aspire.dev/whats-new/aspire-13/#dockerfile-builder-api-experimental
this should be added to the golang resource, so that the dev can avoid define its own dockerfile for golang apps.
Usage example
adding the golang app this way
var golang = builder.AddGolangApp("golang", "../gin-api")
.WithHttpEndpoint(env: "PORT")
.WithHttpHealthCheck("/health");
would automatically support the publish as dockerfile without defining one.
Breaking change?
No
Alternatives
var golang = builder.AddGolangApp("golang", "../gin-api")
.WithHttpEndpoint(env: "PORT")
.WithHttpHealthCheck("/health")
.PublishAsDockerfile();
this would work given the dockerfile is found in the working directory.
Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item
Copilot
Metadata
Metadata
Assignees
Labels
No labels