Phase 2.1: Backend project initialized with Docker configuration
- Created Cargo.toml with all required dependencies - Implemented health/ready endpoints - Added Docker configuration (production + development) - Configured docker-compose with resource limits - Set up MongoDB service with persistence - Verified build (cargo check passed) - Prepared monorepo structure for mobile/web/shared Next: Phase 2.2 (MongoDB connection and models)
This commit is contained in:
parent
4dca44dbbe
commit
1e38fe3ace
11 changed files with 388 additions and 80 deletions
18
backend/docker/Dockerfile
Normal file
18
backend/docker/Dockerfile
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
FROM rust:1.75-alpine AS builder
|
||||
WORKDIR /app
|
||||
RUN apk add --no-cache musl-dev pkgconf openssl-dev
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
RUN mkdir src && echo 'fn main() {}' > src/main.rs
|
||||
RUN cargo build --release && rm -rf src
|
||||
COPY src ./src
|
||||
RUN touch src/main.rs && cargo build --release
|
||||
|
||||
FROM alpine:3.18
|
||||
WORKDIR /app
|
||||
RUN apk add --no-cache ca-certificates openssl wget
|
||||
COPY --from=builder /app/target/release/normogen-backend /app/normogen-backend
|
||||
RUN addgroup -g 1000 normogen && adduser -D -u 1000 -G normogen normogen && chown -R normogen:normogen /app
|
||||
USER normogen
|
||||
EXPOSE 8000
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 CMD wget --no-verbose --tries=1 --spider http://localhost:8000/health || exit 1
|
||||
CMD ['./normogen-backend']
|
||||
Loading…
Add table
Add a link
Reference in a new issue