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
FROM node:20-alpine as build
FROM node:20-alpine AS build
WORKDIR /app
@@ -23,16 +23,23 @@ ENV VITE_APPWRITE_PROJECT_ID=$VITE_APPWRITE_PROJECT_ID
# Build the app
RUN npm run build
# Production stage
FROM nginx:alpine
# Production stage - lightweight Node.js server
FROM node:20-alpine
# Copy built files
COPY --from=build /app/dist /usr/share/nginx/html
WORKDIR /app
# Copy nginx config
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Install serve globally
RUN npm install -g serve
# Expose port
EXPOSE 80
# Copy built files from build stage
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"]