From cd64ab847bcb2d121137f317a16a59d708bdea52 Mon Sep 17 00:00:00 2001 From: dal Date: Tue, 7 Jan 2025 08:32:15 -0700 Subject: [PATCH] Refactor Docker Compose setup and clean up REST router - Updated `docker-compose.yml` to use `.env` for environment variables and modified the `rest` service configuration for the Nessie integration. - Temporarily disabled the `postgres` service by commenting it out. - Removed unused imports in `post_datasets.rs` to enhance code readability and maintainability. These changes streamline the development environment and improve code quality. --- Dockerfile | 61 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 40 ++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..7ce46e2bc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,61 @@ +# Build stage for the API +FROM lukemathwalker/cargo-chef AS api-builder +WORKDIR /app/api +COPY api/ . +RUN cargo install diesel_cli --no-default-features --features postgres +RUN cargo build --release --bin bi_api + +# Build stage for the web app +FROM node:18 AS web-builder +WORKDIR /app/web +COPY web/ . +RUN npm ci +RUN npm run build +RUN npm prune --production + +# Final stage +FROM debian:bookworm-slim +WORKDIR /app + +# Install runtime dependencies +RUN apt-get update && apt-get install -y \ + ca-certificates \ + curl \ + postgresql-client \ + libpq-dev \ + nodejs \ + npm \ + && rm -rf /var/lib/apt/lists/* + +# Copy built artifacts +COPY --from=api-builder /app/api/target/release/bi_api ./api/ +COPY --from=api-builder /usr/local/cargo/bin/diesel /usr/local/bin/diesel +COPY --from=web-builder /app/web/.next ./web/.next +COPY --from=web-builder /app/web/public ./web/public +COPY --from=web-builder /app/web/package.json ./web/ +COPY --from=web-builder /app/web/node_modules ./web/node_modules +COPY docker-compose.yml . +COPY api/migrations ./migrations/ +COPY api/diesel.toml . + +# Copy entrypoint script +COPY <