48 lines
1.1 KiB
Nginx Configuration File
48 lines
1.1 KiB
Nginx Configuration File
# Production nginx image for serving Slate documentation
|
|
# Built by CI after Slate generates static HTML
|
|
|
|
FROM nginx:alpine
|
|
|
|
# Remove default nginx content
|
|
RUN rm -rf /usr/share/nginx/html/*
|
|
|
|
# Copy built static files from Slate
|
|
COPY build/ /usr/share/nginx/html/
|
|
|
|
# Custom nginx config for SPA-style routing
|
|
RUN cat > /etc/nginx/conf.d/default.conf << 'EOF'
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Enable gzip compression
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript;
|
|
gzip_min_length 1000;
|
|
|
|
# Cache static assets
|
|
location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# Serve index.html for all routes (SPA fallback)
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Health check endpoint
|
|
location /health {
|
|
access_log off;
|
|
return 200 "OK";
|
|
add_header Content-Type text/plain;
|
|
}
|
|
}
|
|
EOF
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|