Add full Docker setup so the app runs with a single 'docker compose up':
- Dockerfile: multi-stage build (node:22-alpine) for the SvelteKit app
- docker-compose.yml: three services:
1. ollama: runs Ollama server with persistent volume for models
2. model-init: one-shot container that pulls the configured model
after Ollama is healthy, then exits
3. app: the SvelteKit app, starts only after model-init succeeds
- .env.docker: set OLLAMA_MODEL to control which model is pulled
- .dockerignore: keeps image lean
- Switched adapter-auto to adapter-node (required for Docker/Node hosting)
- Updated README with Docker and local dev instructions
Usage:
docker compose up # default: llama3
OLLAMA_MODEL=gemma2 docker compose up # any Ollama model
27 lines
414 B
Docker
27 lines
414 B
Docker
# ---- Build stage ----
|
|
FROM node:22-alpine AS build
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci
|
|
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# ---- Run stage ----
|
|
FROM node:22-alpine AS run
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --omit=dev
|
|
|
|
COPY --from=build /app/build ./build
|
|
COPY --from=build /app/package.json .
|
|
|
|
ENV PORT=3000
|
|
ENV HOST=0.0.0.0
|
|
EXPOSE 3000
|
|
|
|
CMD ["node", "build"] |