This commit is contained in:
1 parent
7120927224
commit
30ba55de56
3 files changed
+101
No files matched your search
@@ -0,0 +1,32 @@
|
|||||||
|
name: Publish container image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: gt.uo1.net/1movmedia/ollama-with-model
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Log in to Gitea registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: gt.uo1.net
|
||||||
|
username: ${{ vars.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
|
- name: Build and publish
|
||||||
|
uses: docker/build-push-action@v7
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.IMAGE_NAME }}:latest
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
ARG BASE_IMAGE=ollama/ollama:latest
|
||||||
|
|
||||||
|
FROM ${BASE_IMAGE}
|
||||||
|
|
||||||
|
ARG MODEL=orcarouter/Qwen3.8-27B-Uncensored:q3_K_L
|
||||||
|
|
||||||
|
RUN set -eu; \
|
||||||
|
ollama serve >/tmp/ollama.log 2>&1 & \
|
||||||
|
server_pid=$!; \
|
||||||
|
trap 'kill "$server_pid"; wait "$server_pid" || true' 0; \
|
||||||
|
until ollama list >/dev/null 2>&1; do sleep 1; done; \
|
||||||
|
ollama pull "${MODEL}"; \
|
||||||
|
rm -f /tmp/ollama.log
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
# 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 and publishes the `latest` tag on pushes to `main`. It 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.
|
||||||
Reference in new issue
Block a user