Spaces:
Sleeping
Sleeping
Upload Dockerfile
Browse files- Dockerfile +43 -0
Dockerfile
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use an official Python 3.11 image as the base
|
2 |
+
FROM python:3.11-slim
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
# Install system dependencies for Caddy
|
7 |
+
RUN apt-get update && apt-get install -y debian-keyring debian-archive-keyring apt-transport-https curl gnupg2
|
8 |
+
|
9 |
+
# Add Caddy's GPG key and repository
|
10 |
+
RUN curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg \
|
11 |
+
&& curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
|
12 |
+
|
13 |
+
# Update and install Caddy
|
14 |
+
RUN apt-get update && apt-get install -y caddy
|
15 |
+
|
16 |
+
# Create Caddyfile for reverse proxy
|
17 |
+
RUN echo ":7860 {\n \
|
18 |
+
reverse_proxy localhost:8080\n \
|
19 |
+
}" > /etc/caddy/Caddyfile
|
20 |
+
|
21 |
+
RUN useradd -m -u 1000 user
|
22 |
+
USER user
|
23 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
24 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
25 |
+
|
26 |
+
# Set the working directory
|
27 |
+
WORKDIR /app
|
28 |
+
|
29 |
+
# Reset pip source to ensure it's using pypi.org and upgrade pip
|
30 |
+
RUN pip config set global.index-url https://pypi.org/simple \
|
31 |
+
&& python -m pip install --upgrade pip
|
32 |
+
|
33 |
+
# Install open-webui
|
34 |
+
RUN pip install open-webui
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
# Expose port 7860
|
39 |
+
EXPOSE 7860
|
40 |
+
|
41 |
+
COPY --chown=user . /app
|
42 |
+
|
43 |
+
CMD ["sh", "-c", "open-webui serve & caddy run --config /etc/caddy/Caddyfile"]
|