first commit

This commit is contained in:
Optirx
2026-01-15 12:00:40 +02:00
parent b3cd2d8a11
commit a1fd8b5cea
2 changed files with 17 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
# Build stage # Build stage
FROM node:20-alpine as build FROM node:20-alpine AS build
WORKDIR /app WORKDIR /app
@@ -23,16 +23,23 @@ ENV VITE_APPWRITE_PROJECT_ID=$VITE_APPWRITE_PROJECT_ID
# Build the app # Build the app
RUN npm run build RUN npm run build
# Production stage # Production stage - lightweight Node.js server
FROM nginx:alpine FROM node:20-alpine
# Copy built files WORKDIR /app
COPY --from=build /app/dist /usr/share/nginx/html
# Copy nginx config # Install serve globally
COPY nginx.conf /etc/nginx/conf.d/default.conf RUN npm install -g serve
# Expose port # Copy built files from build stage
EXPOSE 80 COPY --from=build /app/dist ./dist
CMD ["nginx", "-g", "daemon off;"] # Run as non-root user for security
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001 -G nodejs && \
chown -R nodejs:nodejs /app
USER nodejs
# Start serve on port 3000
CMD ["serve", "-s", "dist", "-l", "3000"]

View File

@@ -1,21 +0,0 @@
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Gzip compression
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
# Handle SPA routing - redirect all requests to 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";
}
}