Open
Description
Hi, thanks for great tool! Trying to customise build configuration, but found some issues and i need some help.
Use cases
- Build monorepo with nextjs
- Respository structure is classic for turborepo
- Have several apps to build with docker and deploy with serverless container

Build config
name: example
deployment:
type: [email protected]
containers:
example-docs:
src: ./apps/example-docs
routing:
domain: dev-docs.example.com
pathPattern: /*
pathHealthCheck: /api/health
environment:
HELLO: world
compute:
type: awsFargateEcs
example-web:
src: ./apps/example-web
compute:
type: awsFargateEcs
awsFargateEcs:
cpu: 256
memory: 512
build:
args: # Optional: Arguments to pass to the build, as a map of key-value pairs. This is useful for passing in build arguments to the Dockerfile, like ssh keys to fetch private dependencies, etc.
key: value # Example: ARG key=value
dockerFileString: ./apps/example-web/Dockerfile
routing:
domain: dev-web.example.com
pathPattern: /*
pathHealthCheck: /api/health
environment:
HELLO: world
Build error
When i try to deploy this config - it errors with on serverless deploy
- Unrecognized key(s): build
{
"source": "sfcore.analysis.generated.v1",
"event": {
"actionSucceeded": false,
"operatingSystem": "linux",
"architecture": "x64",
"cicd": true,
...
"isCompose": false,
"projectType": "containers",
"cliOptions": [
"stage",
"debug"
],
"source": "[email protected]",
"actionName": "deploy",
"configurationFileName": "serverless.containers.yml",
"resolvers": [],
"error": {
"name": "Error",
"message": "Invalid configuration:\n\n - Unrecognized key(s): build\n\n",
"code": "INVALID_CONFIGURATION"
}
}
}
Build error analysis
- Container framework configuration is correct ✅
- Example
containers:
my-container:
src: ./path/to/container # Required: Path to the container source code.
compute: # Required: Compute configuration.
build: # Optional: Build configuration.
environment: # Optional: Environment variables to pass to the container.
routing: # Required: Routing configuration.
dev: # Optional: Development mode configuration
- Actual
example-web:
src: ./apps/example-web
compute:
build:
args: # Optional: Arguments to pass to the build, as a map of key-value pairs. This is useful for passing in build arguments to the Dockerfile, like ssh keys to fetch private dependencies, etc.
key: value # Example: ARG key=value
dockerFileString: ./apps/example-web/Dockerfile
- Could not find source code to check - is it opensoured?
- Main hypothesis - looks like a bug 🐛
Docker examples?
- Could not find any example in repository https://github.com/serverless/containers
- Could not find any example in https://www.serverless.com/containers/docs/configuration
More bugs?
- hypothesis that
dockerFileString
-> supposed to bedockerFile
as is see in serverless configuration
Proposual for configuration update
- Based on docker-compose configuration vs serverless-container configuration:
- Serverless:
src: ./path/to/container
- Path to the container source code and mainly build context for Dockerfile - Docker compose:
context: .
- build context for docker file
- Serverless:
Add build context to separate src and context
- Why? Monorepo use cases - all build made from root build context.
- Why? Prepare repo - with prune command https://turbo.build/repo/docs/reference/prune
- Why? Nextjs standalone build for docker - https://nextjs.org/docs/pages/building-your-application/deploying
Would be great to add build context for Dockerfile.
Example:
- Why? Nextjs standalone build for docker - https://nextjs.org/docs/pages/building-your-application/deploying
- Why? Prepare repo - with prune command https://turbo.build/repo/docs/reference/prune
build:
args: # Optional: Arguments to pass to the build, as a map of key-value pairs. This is useful for passing in build arguments to the Dockerfile, like ssh keys to fetch private dependencies, etc.
key: value # Example: ARG key=value
dockerFileString: # Optional: Dockerfile as a string to use for the container (not recommended, prefer
context: # Optional: Build context for docker file```