diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fe907d4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM node:20-alpine AS build +WORKDIR /app + +# Install deps first +COPY package.json package-lock.json* yarn.lock* ./ +RUN if [ -f package-lock.json ]; then npm ci; \ + elif [ -f yarn.lock ]; then yarn install --frozen-lockfile; \ + else npm install; fi + +# Copy sources +COPY . . + +# Build-time env vars for Vite +ARG VITE_SENTRY_DSN +ARG VITE_API_BASE_URL +ARG VITE_API_BASE_STORAGE_URL +ENV VITE_SENTRY_DSN=${VITE_SENTRY_DSN} +ENV VITE_API_BASE_URL=${VITE_API_BASE_URL} +ENV VITE_API_BASE_STORAGE_URL=${VITE_API_BASE_STORAGE_URL} + +RUN npm run build + +FROM nginx:alpine AS runtime +COPY --from=build /app/dist /usr/share/nginx/html + +# Minimal SPA-friendly Nginx config +COPY nginx.conf /etc/nginx/conf.d/default.conf + +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] + diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..908f3c4 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,17 @@ +server { + listen 80; + server_name _; + + # Increase limits for large uploads if needed + client_max_body_size 10G; + client_body_timeout 300s; + client_header_timeout 300s; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri /index.html; + } +} +