fix Dockerfile and compose.yaml

This commit is contained in:
2025-07-17 16:52:57 +02:00
parent 8d707535fd
commit c1f1185ad4
2 changed files with 12 additions and 9 deletions

View File

@@ -17,15 +17,19 @@ FROM rust:bookworm AS backend-builder
WORKDIR /usr/src/warren
COPY backend/Cargo.toml backend/Cargo.lock ./
RUN mkdir src && echo "fn main() {}" > src/main.rs && cargo build --release
RUN mkdir -p src/bin/backend && mkdir src/lib && echo "fn main() {}" > src/bin/backend/main.rs && echo "" > src/lib/lib.rs
RUN cargo build --release
COPY backend/ .
RUN touch src/main.rs && cargo build --release
RUN touch src/bin/backend/main.rs && touch src/lib/lib.rs
RUN cargo build --release
FROM debian:bookworm
WORKDIR /var/lib/warren
COPY --from=backend-builder /usr/src/warren/target/release/warren /usr/bin/warren
COPY --from=backend-builder /usr/src/warren/target/release/warren_backend /usr/bin/warren
COPY --from=frontend-builder /usr/src/warren/dist ./frontend
ENV STATIC_FRONTEND_DIRECTORY "./frontend"
ENTRYPOINT ["warren"]

View File

@@ -11,14 +11,13 @@ services:
networks:
- 'warren-net'
environment:
- 'BIND_ADDRESS=0.0.0.0:8080'
- 'POSTGRES_HOST=warren-postgres'
- 'POSTGRES_PORT=5432'
- 'POSTGRES_USER=postgres'
- 'POSTGRES_PASSWORD=pg'
- 'POSTGRES_DATABASE=warren'
- 'SERVER_ADDRESS=0.0.0.0'
- 'SERVER_PORT=8080'
- 'DATABASE_URL=postgres://postgres:pg@warren-postgres:5432'
- 'DATABASE_NAME=warren'
- 'SERVE_DIRECTORY=/serve'
- 'CORS_ALLOW_ORIGIN=http://localhost:3000'
- 'LOG_LEVEL=debug'
volumes:
- './backend/serve:/serve:rw'
postgres: