Add Docker configuration for self-hosted deployment
- Add Dockerfile with nginx for static file serving - Add docker-compose.yml with Traefik labels - Removes unused Tailwind dependencies during build 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
4c7dafe051
commit
eec7f473a8
|
|
@ -0,0 +1,41 @@
|
|||
# Build stage
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY . .
|
||||
|
||||
# Remove tailwind postcss config and delete tailwindcss to prevent auto-detection
|
||||
RUN rm -f postcss.config.js tailwind.config.js
|
||||
RUN npm uninstall tailwindcss @tailwindcss/postcss 2>/dev/null || true
|
||||
|
||||
RUN npm run build
|
||||
|
||||
# Production stage
|
||||
FROM nginx:alpine
|
||||
|
||||
COPY --from=builder /app/build /usr/share/nginx/html
|
||||
COPY <<EOF /etc/nginx/conf.d/default.conf
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files \$uri \$uri/ /index.html;
|
||||
}
|
||||
|
||||
# Cache static assets
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
services:
|
||||
boredom-dial:
|
||||
build: .
|
||||
container_name: boredom-dial-prod
|
||||
restart: unless-stopped
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.boredom-dial.rule=Host(`bored.jeffemmett.com`)"
|
||||
- "traefik.http.routers.boredom-dial.entrypoints=web"
|
||||
- "traefik.http.services.boredom-dial.loadbalancer.server.port=80"
|
||||
networks:
|
||||
- traefik-public
|
||||
|
||||
networks:
|
||||
traefik-public:
|
||||
external: true
|
||||
Loading…
Reference in New Issue