# Node Alpine -- multi-arch (amd64 + arm64) FROM oven/bun:1.3.11-alpine AS builder WORKDIR /app # Install system dependencies required for Bun RUN apk add --no-cache wget curl bash python3 make g++ # Accept build arguments for environment variables ARG AUTH_ENABLED ARG AUTH_SECRET ARG APPWRITE_ENDPOINT ARG APPWRITE_PROJECT_ID ARG POCKETBASE_URL ARG SESSION_MAX_AGE # Copy package files first for caching COPY package.json bun.lock* ./ # Install dependencies (Node) RUN bun install # Copy the rest of the project COPY . . # Build the project RUN bun run build # Serve with nginx FROM nginx:1.28.2-alpine COPY --from=builder /app/dist /usr/share/nginx/html RUN echo 'server { listen 4173; root /usr/share/nginx/html; index index.html; location / { try_files $uri $uri/ /index.html; } location ~* \.(?:css|js|mjs|map|json|wasm|mp3|flac|wav|ogg|png|jpg|jpeg|svg|webp|ico|gz|br|ttf|woff2?)$ { try_files $uri =404; } }' > /etc/nginx/conf.d/default.conf # Expose the nginx port EXPOSE 4173 CMD ["nginx", "-g", "daemon off;"]