ResolversReference
Resolver Dockerfile
Docker container configuration for resolvers
Resolver Dockerfile
Resolvers run as Docker containers. The Dockerfile defines the container environment. Resolvers listen on port 5553.
Minimal Dockerfile
Dockerfile
FROM oven/bun:1.1.30WORKDIR /app# Required: Mark as CyanPrint resolverLABEL cyanprint.dev=true# Install dependenciesCOPY package.json .COPY bun.lock .RUN bun install# Copy resolver codeCOPY . .# Run resolverCMD ["bun", "run", "index.ts"]
Dockerfile
FROM python:3.11-slimWORKDIR /app# Required: Mark as CyanPrint resolverLABEL cyanprint.dev=true# Install dependenciesCOPY requirements.txt .RUN pip install --no-cache-dir -r requirements.txt# Copy resolver codeCOPY . .# Run resolverCMD ["python", "-u", "main.py"]
Dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS baseWORKDIR /appENV ASPNETCORE_URLS=http://+:5553FROM mcr.microsoft.com/dotnet/sdk:8.0 AS buildWORKDIR /srcCOPY ["MyResolver.csproj", "./"]RUN dotnet restore "MyResolver.csproj"COPY . .RUN dotnet build "MyResolver.csproj" -c Release -o /app/buildFROM build AS publishRUN dotnet publish "MyResolver.csproj" -c Release -o /app/publish /p:UseAppHost=falseFROM base AS finalWORKDIR /appCOPY --from=publish /app/publish .# Required: Mark as CyanPrint resolverLABEL cyanprint.dev=trueENTRYPOINT ["dotnet", "MyResolver.dll"]
Required Elements
LABEL cyanprint.dev=true
This label identifies the container as a CyanPrint resolver:
LABEL cyanprint.dev=true
Port 5553
Resolvers must listen on port 5553. The SDKs handle this automatically for most languages:
- Bun/Node.js SDK: Listens on port 5553 automatically
- Python SDK: Listens on port 5553 automatically
- .NET SDK: Requires explicit configuration:
ENV ASPNETCORE_URLS=http://+:5553
WORKDIR
Set the working directory. The convention is /app:
WORKDIR /app
CMD / ENTRYPOINT
The command that runs the resolver
# BunCMD ["bun", "run", "index.ts"]# Node.jsCMD ["node", "index.js"]
CMD ["python", "-u", "main.py"]
ENTRYPOINT ["dotnet", "MyResolver.dll"]
Full Example with Multi-Stage Build
Dockerfile
# Build stageFROM oven/bun:1.1.30-alpine AS builderWORKDIR /appCOPY package.json .COPY bun.lock .RUN bun installCOPY . .RUN bun build index.ts --outdir=dist --target=bun# Final stageFROM oven/bun:1.1.30-alpineLABEL cyanprint.dev=trueWORKDIR /appCOPY --from=builder /app/dist ./distCMD ["bun", "run", "dist/index.js"]
Dockerfile
FROM python:3.11-slimWORKDIR /app# Create non-root user for securityRUN useradd --create-home --shell /bin/bash appuserLABEL cyanprint.dev=trueCOPY requirements.txt .RUN pip install --no-cache-dir -r requirements.txtCOPY . .USER appuserCMD ["python", "-u", "main.py"]
Dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS baseWORKDIR /appENV ASPNETCORE_URLS=http://+:5553FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS buildARG TARGETARCHWORKDIR /srcCOPY ["MyResolver.csproj", "./"]RUN dotnet restore -a $TARGETARCH "MyResolver.csproj"COPY . .WORKDIR "/src/"RUN dotnet build "MyResolver.csproj" -a $TARGETARCH -c Release -o /app/buildFROM build AS publishRUN dotnet publish "MyResolver.csproj" -a $TARGETARCH -c Release -o /app/publish /p:UseAppHost=falseFROM base AS finalLABEL cyanprint.dev=trueWORKDIR /appCOPY --from=publish /app/publish .ENTRYPOINT ["dotnet", "MyResolver.dll"]
Best Practices
1. Use Specific Versions
# Good: Specific versionFROM oven/bun:1.1.30# Avoid: Latest (unpredictable)FROM oven/bun:latest
2. Use .dockerignore
Create a .dockerignore file
node_modules.git.gitignore*.mdtests/.env*
3. Create Non-Root User
For production deployments
# Create non-root user for securityRUN useradd --create-home --shell /bin/bash appuserUSER appuser
Resolvers should be deterministic. Always include your lockfile to ensure consistent dependency versions across builds.