feat: replace Nginx with Caddy for automatic SSL management

- Add Caddyfile with automatic HTTPS configuration
- Add Dockerfile.caddy for frontend build with Caddy
- Update docker-compose.yml to use Caddy service
- Update DEPLOY.md with simplified deployment instructions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
empty
2026-01-26 00:28:15 +08:00
parent 11e5754d05
commit 4d621b5901
4 changed files with 108 additions and 21 deletions

33
deploy/Caddyfile Normal file
View File

@@ -0,0 +1,33 @@
{
email your-email@example.com
}
your-domain.com {
# Mobile client (default)
handle {
root * /srv/mobile
try_files {path} /index.html
file_server
}
# Screen client
handle /screen/* {
root * /srv/screen
uri strip_prefix /screen
try_files {path} /index.html
file_server
}
# API proxy
handle /api/* {
reverse_proxy server:3000
}
# WebSocket proxy
handle /socket.io/* {
reverse_proxy server:3000
}
# Gzip compression
encode gzip
}

32
deploy/Dockerfile.caddy Normal file
View File

@@ -0,0 +1,32 @@
FROM node:20-alpine AS builder
WORKDIR /app
RUN npm install -g pnpm
COPY pnpm-workspace.yaml package.json pnpm-lock.yaml ./
COPY packages/shared ./packages/shared
COPY packages/client-screen ./packages/client-screen
COPY packages/client-mobile ./packages/client-mobile
RUN pnpm install --frozen-lockfile
WORKDIR /app/packages/shared
RUN pnpm build
WORKDIR /app/packages/client-screen
RUN pnpm build
WORKDIR /app/packages/client-mobile
RUN pnpm build
# Production stage - Caddy
FROM caddy:2-alpine
COPY --from=builder /app/packages/client-screen/dist /srv/screen
COPY --from=builder /app/packages/client-mobile/dist /srv/mobile
COPY deploy/Caddyfile /etc/caddy/Caddyfile
EXPOSE 80 443
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]