Skip to content

Add default dab-config.json to Docker image#3168

Open
Copilot wants to merge 7 commits intomainfrom
copilot/add-default-docker-config-file
Open

Add default dab-config.json to Docker image#3168
Copilot wants to merge 7 commits intomainfrom
copilot/add-default-docker-config-file

Conversation

Copy link
Contributor

Copilot AI commented Feb 26, 2026

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:
    # 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:

docker run -e DAB_CONNSTRING="<your-connection-string>" -p 5000:5000 <image>

Override the default config by mounting your own:

docker run -e DAB_CONNSTRING="..." -v ./my-dab-config.json:/App/dab-config.json -p 5000:5000 <image>
Original prompt

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:
{
  "$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:

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:

# Add default dab-config.json to /App in the image
COPY dab-config.json /App/dab-config.json

References in deployment scripts and samples

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)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 26, 2026 17:18
Co-authored-by: Aniruddh25 <3513779+Aniruddh25@users.noreply.github.com>
Co-authored-by: Aniruddh25 <3513779+Aniruddh25@users.noreply.github.com>
Copilot AI changed the title [WIP] Add default configuration file to Docker image Add default dab-config.json to Docker image Feb 26, 2026
@Aniruddh25 Aniruddh25 marked this pull request as ready for review February 26, 2026 17:49
Copilot AI review requested due to automatic review settings February 26, 2026 17:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a default dab-config.json into the published Docker image to improve first-run experience (container can start without mounting a config file, relying on an env-provided connection string).

Changes:

  • Added a new root-level dab-config.json intended to be baked into the Docker image as the default runtime configuration.
  • Updated Dockerfile to copy dab-config.json into /App/dab-config.json in the runtime image.
  • Updated .gitignore to ensure the root dab-config.json is not ignored by the existing dab-config*.json rule.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.

File Description
dab-config.json Introduces a default runtime config intended for Docker image consumption.
Dockerfile Bakes the default config into the runtime image at /App/dab-config.json.
.gitignore Ensures the root default config is tracked despite existing ignore patterns.

@JerryNixon JerryNixon added the 2.0 label Mar 3, 2026

COPY --from=build /out /App
# Add default dab-config.json to /App in the image
COPY dab-config.json /App/dab-config.json
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot, test if a container started with this image runs accurately

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested in dc2bc0e. Built an image with the pre-compiled service and dab-config.json, then ran the container with DAB_CONNSTRING set. Startup logs confirm it works:

Loading config file from /App/dab-config.json.
...
Now listening on: http://[::]:5000
Application started.

Also fixed "provider": "Unauthenticated""Simulator" (the original value failed JSON schema validation and would throw NotSupportedException at startup since it was treated as a JWT provider requiring Audience/Issuer).

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Aniruddh25
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

Co-authored-by: Aniruddh25 <3513779+Aniruddh25@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 4, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • http://api.nuget.org:443/DigiCertTrustedG4RSA4096SHA256TimeStampingCA.crl
    • Triggering command: /usr/bin/dotnet dotnet restore src/Azure.DataApiBuilder.sln (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@Aniruddh25
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

*.dab-config.json
!dab-config.*reference.json
!dab-config.*.example.json
!/dab-config.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is there a /?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Supplement Docker image with default configuration file (dab-config.json)

5 participants