Skip to content

Commit 893e921

Browse files
Piotr Stachaczynskiclaude
andcommitted
feat: InferPage dockerization, model catalog expansion, and Ollama improvements
- Add Dockerfile.inferpage with cpu, cuda, ollama, and ollama-bundled targets - Add entrypoint-ollama.sh for bundled Ollama+InferPage single image - Add docker-compose.inferpage-ollama.yml compose stack - Publish to GHCR via GitHub Actions (no DockerHub secrets needed) - Make Ollama base URL configurable via MaIN__OllamaBaseUrl env var - Add latest Claude (Opus 4.7, Sonnet 4.6, Haiku 4.5), OpenAI (GPT-5.x series, o3, o4-mini, Codex Mini), Gemini (3.x series), Groq (Llama 4, Qwen3, Compound), and Ollama cloud model definitions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 696c27e commit 893e921

24 files changed

Lines changed: 1137 additions & 108 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build and Publish InferPage Docker Images
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
docker:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up QEMU (for linux/arm64 cross-build)
18+
uses: docker/setup-qemu-action@v3
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Log in to GitHub Container Registry
24+
uses: docker/login-action@v3
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Build and push CPU image (linux/amd64 + linux/arm64)
31+
uses: docker/build-push-action@v6
32+
with:
33+
context: ./src
34+
file: ./src/Dockerfile.inferpage
35+
target: runtime-cpu
36+
platforms: linux/amd64,linux/arm64
37+
push: true
38+
tags: |
39+
ghcr.io/${{ github.repository_owner }}/main-inferpage:cpu
40+
ghcr.io/${{ github.repository_owner }}/main-inferpage:latest
41+
cache-from: type=gha
42+
cache-to: type=gha,mode=max
43+
44+
- name: Build and push CUDA image (linux/amd64)
45+
uses: docker/build-push-action@v6
46+
with:
47+
context: ./src
48+
file: ./src/Dockerfile.inferpage
49+
target: runtime-cuda
50+
platforms: linux/amd64
51+
push: true
52+
tags: ghcr.io/${{ github.repository_owner }}/main-inferpage:cuda
53+
cache-from: type=gha
54+
cache-to: type=gha,mode=max
55+
56+
- name: Build and push Ollama-bundled image (linux/amd64 + linux/arm64)
57+
uses: docker/build-push-action@v6
58+
with:
59+
context: ./src
60+
file: ./src/Dockerfile.inferpage
61+
target: runtime-ollama-bundled
62+
platforms: linux/amd64,linux/arm64
63+
push: true
64+
tags: ghcr.io/${{ github.repository_owner }}/main-inferpage:ollama
65+
cache-from: type=gha
66+
cache-to: type=gha,mode=max
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
services:
2+
3+
ollama:
4+
image: ollama/ollama:latest
5+
container_name: ollama
6+
restart: unless-stopped
7+
ports:
8+
- "11434:11434"
9+
volumes:
10+
- ollama-models:/root/.ollama
11+
# Uncomment to enable NVIDIA GPU pass-through:
12+
# deploy:
13+
# resources:
14+
# reservations:
15+
# devices:
16+
# - driver: nvidia
17+
# count: all
18+
# capabilities: [gpu]
19+
20+
inferpage:
21+
image: ghcr.io/${GITHUB_OWNER}/main-inferpage:ollama
22+
container_name: inferpage
23+
restart: unless-stopped
24+
ports:
25+
- "5555:5555"
26+
environment:
27+
MaIN__OllamaBaseUrl: http://ollama:11434
28+
MaIN__BackendType: 7
29+
depends_on:
30+
- ollama
31+
32+
volumes:
33+
ollama-models:

src/.dockerignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
**/bin/
2+
**/obj/
3+
**/.vs/
4+
**/.idea/
5+
**/*.user
6+
**/*.suo
7+
MaIN.Core.UnitTests/
8+
MaIN.Core.IntegrationTests/
9+
MaIN.Core.E2ETests/
10+
**/appsettings.*.local.json

src/Dockerfile.inferpage

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS restore
2+
WORKDIR /src
3+
4+
COPY MaIN.Domain/MaIN.Domain.csproj MaIN.Domain/
5+
COPY MaIN.Infrastructure/MaIN.Infrastructure.csproj MaIN.Infrastructure/
6+
COPY MaIN.Services/MaIN.Services.csproj MaIN.Services/
7+
COPY MaIN.Core/MaIN.Core.csproj MaIN.Core/
8+
COPY MaIN.InferPage/MaIN.InferPage.csproj MaIN.InferPage/
9+
10+
RUN dotnet restore MaIN.InferPage/MaIN.InferPage.csproj
11+
12+
FROM restore AS publish
13+
14+
COPY MaIN.Domain/ MaIN.Domain/
15+
COPY MaIN.Infrastructure/ MaIN.Infrastructure/
16+
COPY MaIN.Services/ MaIN.Services/
17+
COPY MaIN.Core/ MaIN.Core/
18+
COPY MaIN.InferPage/ MaIN.InferPage/
19+
20+
RUN dotnet publish MaIN.InferPage/MaIN.InferPage.csproj \
21+
--framework net10.0 \
22+
--configuration Release \
23+
--no-restore \
24+
--output /app/out
25+
26+
FROM nvidia/cuda:12.9.1-runtime-ubuntu24.04 AS runtime-cuda
27+
28+
RUN apt-get update \
29+
&& apt-get install -y --no-install-recommends \
30+
ca-certificates \
31+
libicu74 \
32+
libgomp1 \
33+
&& rm -rf /var/lib/apt/lists/*
34+
35+
COPY --from=mcr.microsoft.com/dotnet/aspnet:10.0 /usr/share/dotnet /usr/share/dotnet
36+
RUN ln -sf /usr/share/dotnet/dotnet /usr/local/bin/dotnet
37+
38+
WORKDIR /app
39+
40+
ENV DOTNET_ROOT=/usr/share/dotnet
41+
ENV ASPNETCORE_URLS=http://+:5555
42+
ENV ASPNETCORE_ENVIRONMENT=Production
43+
ENV MaIN__ModelsPath=/app/Models
44+
ENV NVIDIA_VISIBLE_DEVICES=all
45+
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
46+
ENV LD_LIBRARY_PATH=/usr/lib/wsl/lib
47+
48+
VOLUME /app/Models
49+
EXPOSE 5555
50+
51+
COPY --from=publish /app/out .
52+
53+
RUN find /app/runtimes/linux-x64/native -maxdepth 2 -mindepth 1 -type d \
54+
| tee /etc/ld.so.conf.d/llamasharp.conf \
55+
&& ldconfig
56+
57+
ENTRYPOINT ["dotnet", "MaIN.InferPage.dll"]
58+
59+
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime-cpu
60+
61+
RUN apt-get update && apt-get install -y --no-install-recommends libgomp1 \
62+
&& rm -rf /var/lib/apt/lists/*
63+
64+
WORKDIR /app
65+
66+
ENV ASPNETCORE_URLS=http://+:5555
67+
ENV ASPNETCORE_ENVIRONMENT=Production
68+
ENV MaIN__ModelsPath=/app/Models
69+
70+
VOLUME /app/Models
71+
EXPOSE 5555
72+
73+
COPY --from=publish /app/out .
74+
75+
ENTRYPOINT ["dotnet", "MaIN.InferPage.dll"]
76+
77+
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime-ollama
78+
79+
WORKDIR /app
80+
81+
ENV ASPNETCORE_URLS=http://+:5555
82+
ENV ASPNETCORE_ENVIRONMENT=Production
83+
ENV MaIN__OllamaBaseUrl=http://host.docker.internal:11434
84+
ENV MaIN__BackendType=7
85+
86+
EXPOSE 5555
87+
88+
COPY --from=publish /app/out .
89+
90+
ENTRYPOINT ["dotnet", "MaIN.InferPage.dll"]
91+
92+
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime-ollama-bundled
93+
94+
COPY --from=ollama/ollama:latest /usr/bin/ollama /usr/bin/ollama
95+
96+
WORKDIR /app
97+
98+
ENV ASPNETCORE_URLS=http://+:5555
99+
ENV ASPNETCORE_ENVIRONMENT=Production
100+
ENV MaIN__OllamaBaseUrl=http://localhost:11434
101+
ENV MaIN__BackendType=7
102+
103+
VOLUME /root/.ollama
104+
EXPOSE 5555
105+
EXPOSE 11434
106+
107+
COPY --from=publish /app/out .
108+
COPY entrypoint-ollama.sh /entrypoint.sh
109+
RUN chmod +x /entrypoint.sh
110+
111+
ENTRYPOINT ["/entrypoint.sh"]

src/MaIN.Core/.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package>
33
<metadata>
44
<id>MaIN.NET</id>
5-
<version>0.10.5</version>
5+
<version>0.10.9</version>
66
<authors>Wisedev</authors>
77
<owners>Wisedev</owners>
88
<icon>favicon.png</icon>

src/MaIN.Core/Hub/Contexts/Interfaces/ModelContext/IModelContext.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using MaIN.Domain.Models.Abstract;
1+
using MaIN.Core.Hub.Contexts;
2+
using MaIN.Domain.Models.Abstract;
3+
using MaIN.Infrastructure.Models;
24

35
namespace MaIN.Core.Hub.Contexts.Interfaces.ModelContext;
46

@@ -51,6 +53,8 @@ public interface IModelContext
5153
/// returning the context instance implementing <see cref="IModelContext"/> for method chaining.</returns>
5254
Task<IModelContext> DownloadAsync(string modelId, CancellationToken cancellationToken = default);
5355

56+
Task<IModelContext> DownloadAsync(string modelId, IProgress<DownloadProgress>? progress, CancellationToken cancellationToken = default);
57+
5458
/// <summary>
5559
/// Ensures a known local model is downloaded before use. If the model is already present on disk the call
5660
/// returns immediately; if not, the model is downloaded. Cloud models are silently skipped.
@@ -62,6 +66,8 @@ public interface IModelContext
6266
/// <see cref="IModelContext"/> for method chaining.</returns>
6367
Task<IModelContext> EnsureDownloadedAsync(string modelId, CancellationToken cancellationToken = default);
6468

69+
Task<IModelContext> EnsureDownloadedAsync(string modelId, IProgress<DownloadProgress>? progress, CancellationToken cancellationToken = default);
70+
6571
/// <summary>
6672
/// Ensures a known local model is downloaded before use using a strongly-typed model reference.
6773
/// If the model is already present on disk the call returns immediately; if not, the model is downloaded.

0 commit comments

Comments
 (0)