57 lines
1.9 KiB
Markdown
57 lines
1.9 KiB
Markdown
# Ollama with a preloaded model
|
|
|
|
An [`ollama/ollama:latest`](https://hub.docker.com/r/ollama/ollama) image with the following model downloaded during the build:
|
|
|
|
```text
|
|
orcarouter/Qwen3.8-27B-Uncensored:q3_K_L
|
|
```
|
|
|
|
The image is published to the public Gitea container registry as:
|
|
|
|
```text
|
|
gt.uo1.net/1movmedia/ollama-with-model:latest
|
|
```
|
|
|
|
## Run
|
|
|
|
```sh
|
|
docker pull gt.uo1.net/1movmedia/ollama-with-model:latest
|
|
docker run --rm --gpus all -p 11434:11434 \
|
|
gt.uo1.net/1movmedia/ollama-with-model:latest
|
|
```
|
|
|
|
The Ollama API is then available at `http://localhost:11434`. Start a request with the preloaded model:
|
|
|
|
```sh
|
|
curl http://localhost:11434/api/generate \
|
|
-d '{"model":"orcarouter/Qwen3.8-27B-Uncensored:q3_K_L","prompt":"Hello"}'
|
|
```
|
|
|
|
Remove `--gpus all` to run without an NVIDIA GPU.
|
|
|
|
## Build locally
|
|
|
|
The base image and model have defaults and can be overridden with Docker build arguments:
|
|
|
|
```sh
|
|
docker build -t ollama-with-model:latest .
|
|
|
|
docker build -t ollama-with-model:custom \
|
|
--build-arg BASE_IMAGE=ollama/ollama:latest \
|
|
--build-arg MODEL=orcarouter/Qwen3.8-27B-Uncensored:q3_K_L \
|
|
.
|
|
```
|
|
|
|
Building downloads the complete model, so the runner needs enough disk space for the Ollama base image, model data, and build layers.
|
|
|
|
## Publish from Gitea Actions
|
|
|
|
The workflow in `.gitea/workflows/publish.yml` builds the image by digest, then publishes the `latest` tag in a separate job. After a successful publication, it removes every other version of the image from the Gitea registry. It runs on pushes to `main` and can also be started manually with `workflow_dispatch`.
|
|
|
|
Configure the following repository Actions variable and secret before running it:
|
|
|
|
- Variable `REGISTRY_USERNAME`: a Gitea user with write access to the `1movmedia` package registry.
|
|
- Secret `REGISTRY_TOKEN`: a Gitea personal access token with package read/write permission.
|
|
|
|
The `1movmedia` organization must be public for unauthenticated image pulls.
|