Add Caddy webserver implementation

This commit is contained in:
Andreas Düren
2025-03-17 00:13:38 +01:00
parent 6546f26d52
commit 42c1374606
3 changed files with 144 additions and 6 deletions

View File

@ -78,10 +78,16 @@ RUN mkdir -p /build/web/photos /build/web/accounts /build/web/auth /build/web/ca
FROM cloudron/base:5.0.0@sha256:04fd70dbd8ad6149c19de39e35718e024417c3e01dc9c6637eaf4a41ec4e596c
# Install necessary packages
# Install necessary packages and Caddy webserver
RUN apt-get update && \
apt-get install -y curl git nodejs npm libsodium23 libsodium-dev pkg-config postgresql-client && \
npm install -g yarn serve && \
# Install Caddy for web server
apt-get install -y debian-keyring debian-archive-keyring apt-transport-https && \
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 && \
apt-get update && \
apt-get install -y caddy && \
apt-get clean && apt-get autoremove && \
rm -rf /var/cache/apt /var/lib/apt/lists
@ -94,7 +100,7 @@ RUN curl -L https://go.dev/dl/go1.24.1.linux-amd64.tar.gz -o go.tar.gz && \
ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt
# Set up directory structure
RUN mkdir -p /app/code /app/data/config /app/web
RUN mkdir -p /app/code /app/data/config /app/data/caddy /app/web
WORKDIR /app/code
@ -137,7 +143,9 @@ ADD config.template.yaml /app/pkg/
# Set proper permissions
RUN chmod +x /app/pkg/start.sh
# Expose the API port
# Expose the web port (Cloudron expects port 3080)
EXPOSE 3080
# Also expose API port
EXPOSE 8080
# Start the application