Multiple apps and build contexts

Hello,

What is the use of having multiple apps in a project if we cannot specify a build context for these apps ?

For instance, with two apps like below, I would expect a parameter for the “docker build plugin” such as context :

project = "my-project"

# Labels can be specified for organizational purposes.
# labels = { "foo" = "bar" }

# An application to deploy.
app "web" {
    build {
        use "docker" {
          context = 'web/Dockerfile' # -> suggested syntax
        }

        # Uncomment below to use a remote docker registry to push your built images.
        #
        # registry {
        #   use "docker" {
        #     image = "registry.example.com/image"
        #     tag   = "latest"
        #   }
        # }

    }

    # Deploy to Docker
    deploy {
        use "docker" {}
    }
}

# Another application to deploy.
app "backend" {
    build {
        use "docker" {
          context = 'api/Dockerfile' # -> suggested syntax
        }

        # Uncomment below to use a remote docker registry to push your built images.
        #
        # registry {
        #   use "docker" {
        #     image = "registry.example.com/image"
        #     tag   = "latest"
        #   }
        # }

    }

    # Deploy to Docker
    deploy {
        use "docker" {}
    }
}

I didn’t find in the documentation such a feature. The only parameters available are buildkit and disable_entrypoint.
Is it missing ? Or am i misusing the concepts ?

Thanks for your help

Mathieu

Hey @debovema,

Have you tried the following syntax ?

Although I agree with you, having a way to specify the path to a Dockerfile in an application would be great.
For example, we often have the Dockerfile in ./cmd/api/Dockerfile for Go applications and so far I can’t find a way to make this structure work with the docker builder.

project = "my-project"

app "web" {
    path = "./web"

    build {
        use "docker" {}
    }

    deploy {
        use "docker" {}
    }
}

app "backend" {
    path = "./backend"

    build {
        use "docker" {}
    }

    deploy {
        use "docker" {}
    }
}
2 Likes

Thank you it works !
I think that the documentation is not very clear on the usage of path in exemples.

And your use case could be an issue and require a feature request in the future.

Anyway this project is still very young but very promising…

2 Likes

Great :grinning:.

I was able to make the plugin accept the path to a Dockerfile locally. I will send a pull request with the changes today.

1 Like

Thanks everyone. Great feedback. Thanks to a community PR we also merged the ability to specify a separate Dockerfile path which will be in 0.1.2 as well.

4 Likes

How is the release cadence on this one anyway? When will 0.1.2 be released?

Today!

Release cadence should be quite high especially early in the project.

2 Likes

Waypoint 0.1.2 is now released.

2 Likes