Commit a7c1be3
Add default dab-config.json to Docker image (#3168)
## Why make this change?
The Docker image shipped with no default configuration file, requiring
users to supply one before the container would start — a poor
out-of-the-box experience for first-time users.
## What is this change?
- **`dab-config.json`** (new, repo root) — Default configuration baked
into the image:
- `mssql` database type; connection string resolved at runtime via
`@env('DAB_CONNSTRING')` (no secrets committed)
- REST (`/api`), GraphQL (`/graphql`), and MCP (`/mcp`) endpoints
enabled
- `autoentities.default` template with `dml-tools` enabled and explicit
`anonymous: ["create", "read", "update", "delete"]` permissions
- Authentication provider set to `"Simulator"` (valid dev-mode provider
per schema)
- Host mode: `development`
- `$schema` points to `releases/latest/download/dab.draft.schema.json`
(always current, never stale)
- **`Dockerfile`** — Copies the default config into the runtime image:
```dockerfile
# Add default dab-config.json to /App in the image
COPY dab-config.json /App/dab-config.json
```
- **`.gitignore`** — Added `!/dab-config.json` exception; the existing
`dab-config*.json` rule was silently excluding this file from version
control.
## How was this tested?
- [ ] Integration Tests
- [ ] Unit Tests
Container startup was manually verified: built an image using the
compiled service binary and the default `dab-config.json`, then ran it
with `DAB_CONNSTRING` set. Logs confirmed successful startup:
```
Loading config file from /App/dab-config.json.
Now listening on: http://[::]:5000
Application started.
```
JSON schema validation was also confirmed to pass against
`schemas/dab.draft.schema.json`.
## Sample Request(s)
Run the container with just a connection string — no config mount
required:
```bash
docker run -e DAB_CONNSTRING="<your-connection-string>" -p 5000:5000 <image>
```
Override the default config by mounting your own:
```bash
docker run -e DAB_CONNSTRING="..." -v ./my-dab-config.json:/App/dab-config.json -p 5000:5000 <image>
```
<!-- START COPILOT ORIGINAL PROMPT -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>Supplement Docker image with default configuration file
(dab-config.json)</issue_title>
> <issue_description>## Problem
>
> The current Docker image does not include a default configuration
file, making it less user-friendly for those getting started.
>
> ## Proposal
>
> - Add a default configuration file named `dab-config.json` to the
Docker image.
> - The file should be available in a standard location within the
image, such as `/App/dab-config.json` (see the Dockerfile below).
> - The file should contain the following settings:
>
> ```json
> {
> "$schema":
"https://github.com/Azure/data-api-builder/releases/download/v1.7.86-rc/dab.draft.schema.json",
> "data-source": {
> "database-type": "mssql",
> "connection-string": "@env('DAB_CONNSTRING')",
> "options": {
> "set-session-context": false
> }
> },
> "runtime": {
> "rest": {
> "enabled": true,
> "path": "/api",
> "request-body-strict": false
> },
> "graphql": {
> "enabled": true,
> "path": "/graphql",
> "allow-introspection": true
> },
> "mcp": {
> "enabled": true,
> "path": "/mcp"
> },
> "host": {
> "cors": {
> "origins": [],
> "allow-credentials": false
> },
> "authentication": {
> "provider": "Unauthenticated"
> },
> "mode": "development"
> }
> },
> "entities": {},
> "autoentities": {
> "default": {
> "template": {
> "mcp": { "dml-tool": true },
> "rest": { "enabled": true},
> "graphql": { "enabled": true },
> "health": { "enabled": true },
> "cache": {
> "enabled": false
> }
> },
> "permissions": [
> {
> "role": "anonymous",
> "actions": [
> "*"
> ]
> }
> ]
> }
> }
> }
> ```
>
> ## Benefit
>
> Including this configuration file will provide immediate guidance for
users, improve out-of-the-box experience, and make Docker-based
experimentation much easier.
>
> ## Relevant code locations
>
> **Dockerfile**
> The Docker image is defined by
[`Dockerfile`](https://github.com/Azure/data-api-builder/blob/main/Dockerfile):
>
> ```dockerfile
> FROM mcr.microsoft.com/dotnet/sdk:8.0-cbl-mariner2.0. AS build
>
> WORKDIR /src
> COPY [".", "./"]
> RUN dotnet build "./src/Service/Azure.DataApiBuilder.Service.csproj"
-c Docker -o /out -r linux-x64
>
> FROM mcr.microsoft.com/dotnet/aspnet:8.0-cbl-mariner2.0 AS runtime
> COPY --from=build /out /App
> WORKDIR /App
> ENV ASPNETCORE_URLS=http://+:5000
> ENTRYPOINT ["dotnet", "Azure.DataApiBuilder.Service.dll"]
> ```
>
> To add the default config, include a line such as:
>
> ```dockerfile
> # Add default dab-config.json to /App in the image
> COPY dab-config.json /App/dab-config.json
> ```
>
> **References in deployment scripts and samples**
>
> -
[`samples/aspire/apphost.cs`](https://github.com/Azure/data-api-builder/blob/main/samples/aspire/apphost.cs#L30-L48)
binds `dab-config.json` into the container at `/App/dab-config.json`.
> -
[`samples/azure/bicep/dab-on-aca.bicep`](https://github.com/Azure/data-api-builder/blob/main/samples/azure/bicep/dab-on-aca.bicep)
and
>
[`samples/azure/azure-container-apps-deploy.sh`](https://github.com/Azure/data-api-builder/blob/main/samples/azure/azure-container-apps-deploy.sh)
> reference mounting and passing `dab-config.json`.
> - Documentation and deployment code often expect this file to be named
`dab-config.json` and placed at `/App/dab-config.json` or a similar
standard path.
>
> > Please ensure the Docker image has this default config at
`/App/dab-config.json`, and consider documenting override patterns for
cloud and local deployments.</issue_description>
>
> <agent_instructions>refer to
.github/copilot-instructions.md</agent_instructions>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>
</details>
<!-- START COPILOT CODING AGENT SUFFIX -->
- Fixes #3160
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Aniruddh25 <[email protected]>
Co-authored-by: Aniruddh Munde <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Anusha Kolan <[email protected]>1 parent 1dd0882 commit a7c1be3
3 files changed
Lines changed: 61 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
0 commit comments