Create Dockerfile
Browse files- Dockerfile +39 -0
Dockerfile
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Builder stage
|
| 2 |
+
FROM ubuntu:latest
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
# 安装必要的依赖和 Caddy
|
| 6 |
+
RUN apt-get update && apt-get install -y wget curl ca-certificates openssl
|
| 7 |
+
RUN apt-get install -y tmux
|
| 8 |
+
# Install application
|
| 9 |
+
RUN curl https://ollama.ai/install.sh | sh
|
| 10 |
+
# Create the directory and give appropriate permissions
|
| 11 |
+
RUN mkdir -p /.ollama && chmod 777 /.ollama
|
| 12 |
+
|
| 13 |
+
WORKDIR /.ollama
|
| 14 |
+
# 安装必要的依赖
|
| 15 |
+
RUN apt-get update && \
|
| 16 |
+
apt-get install -y \
|
| 17 |
+
debian-keyring \
|
| 18 |
+
debian-archive-keyring \
|
| 19 |
+
apt-transport-https \
|
| 20 |
+
curl
|
| 21 |
+
|
| 22 |
+
# 添加 Caddy 的 GPG 密钥
|
| 23 |
+
RUN curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
|
| 24 |
+
|
| 25 |
+
# 添加 Caddy 的 APT 源
|
| 26 |
+
RUN curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
|
| 27 |
+
|
| 28 |
+
# 更新 APT 包列表并安装 Caddy
|
| 29 |
+
RUN apt-get update && \
|
| 30 |
+
apt-get install -y caddy
|
| 31 |
+
# Create the directory and give appropriate permissions
|
| 32 |
+
RUN mkdir -p /.ollama && chmod 777 /.ollama
|
| 33 |
+
# 复制 Caddyfile 配置到容器中
|
| 34 |
+
COPY Caddyfile /etc/caddy/Caddyfile
|
| 35 |
+
|
| 36 |
+
# 暴露 Caddy 和 Ollama 端口
|
| 37 |
+
EXPOSE 3000
|
| 38 |
+
# 启动 Caddy 和 Ollama 的主命令
|
| 39 |
+
CMD ["sh", "-c", "ollama serve & caddy run --config /etc/caddy/Caddyfile"]
|