FROM dart:3.3.0 AS build # Set working directory WORKDIR /app # Copy pubspec files COPY pubspec.* ./ RUN dart pub get # Copy source code COPY . . # Compile to native code using AOT RUN dart compile exe bin/server.dart -o server # Create runtime image FROM debian:bookworm-slim # Install SSL certificates for HTTPS requests RUN apt-get update && apt-get install -y ca-certificates curl && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app # Create upload directories RUN mkdir -p /app/uploaded/raw /app/uploaded/data # Copy compiled binary from build stage COPY --from=build /app/server /app/server # Set execute permissions RUN chmod +x /app/server # Expose port EXPOSE 8080 # Start server CMD ["/app/server"]