File size: 1,250 Bytes
8931b92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Use an official Python 3.11 image as the base
FROM python:3.11-slim



# Install system dependencies for Caddy
RUN apt-get update && apt-get install -y debian-keyring debian-archive-keyring apt-transport-https curl gnupg2

# Add Caddy's GPG key and repository
RUN curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg \
    && curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list

# Update and install Caddy
RUN apt-get update && apt-get install -y caddy

# Create Caddyfile for reverse proxy
RUN echo ":7860 {\n \
    reverse_proxy localhost:8080\n \
}" > /etc/caddy/Caddyfile

RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
ENV PATH="/home/user/.local/bin:$PATH"

# Set the working directory
WORKDIR /app

# Reset pip source to ensure it's using pypi.org and upgrade pip
RUN pip config set global.index-url https://pypi.org/simple \
    && python -m pip install --upgrade pip

# Install open-webui
RUN pip install open-webui



# Expose port 7860
EXPOSE 7860

COPY --chown=user . /app

CMD ["sh", "-c", "open-webui serve & caddy run --config /etc/caddy/Caddyfile"]