Skip to content

How to exclude a service from a docker compose environment? #9608

Answered by davidfowl
sliekens asked this question in Q&A

You must be logged in to vote

You don't want to remove seq in publish mode, you just want to change how it's expressed.

var builder = DistributedApplication.CreateBuilder(args);

builder.AddDockerComposeEnvironment("docker-compose");

var seq = builder.ExecutionContext.IsPublishMode 
   ? builder.AddConnectionString("seq") 
   : builder.AddSeq("seq").WithLifetime(ContainerLifetime.Persistent);

builder.AddProject<Projects.WebApp>("webapp")
    .WithReference(seq)
    .PublishAsDockerComposeService((resource, service) =>
    {
        service.ContainerName = "webapp";
    });

Replies: 1 comment 4 replies

You must be logged in to vote
4 replies
@sliekens

@davidfowl

@sliekens

@davidfowl

Answer selected by sliekens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants