# Build stage FROM oven/bun:latest as builder WORKDIR /app # Copy package files COPY package.json bun.lock* ./ # Install all dependencies (including devDependencies for building) RUN bun install --frozen-lockfile # Copy source code and configuration files COPY . . # Build the frontend with Vite and compile the server to executable RUN bun run build # Minimal production stage using Alpine FROM alpine:latest # Install CA certificates for HTTPS requests and glibc compatibility RUN apk --no-cache add ca-certificates tzdata gcompat WORKDIR /app # Copy the compiled executable from the build stage (Linux build will not have .exe extension) COPY --from=builder /app/dist/server /app/server # Copy the built frontend assets (but ensure we don't overwrite the server executable) COPY --from=builder /app/dist/*.html /app/dist/ COPY --from=builder /app/dist/assets /app/dist/assets # Make the server executable RUN chmod +x /app/server # Expose the port EXPOSE 3000 # Set environment to production ENV NODE_ENV=production # Start the application using the compiled executable CMD ["/app/server"]