dashboard/backend/Dockerfile

28 lines
534 B
Text
Raw Normal View History

2025-12-16 08:16:27 +09:00
# Build Stage
FROM rust:alpine as builder
WORKDIR /app
RUN apk add --no-cache musl-dev
# Create dummy project to cache dependencies
RUN mkdir src && echo "fn main() {}" > src/main.rs
COPY Cargo.toml .
RUN cargo build --release
# Copy actual source code
COPY src ./src
# Touch main.rs to force rebuild
RUN touch src/main.rs
RUN cargo build --release
# Runtime Stage
FROM alpine:latest
WORKDIR /app
RUN apk add --no-cache libgcc
COPY --from=builder /app/target/release/dashboard-backend .
EXPOSE 8000
CMD ["./dashboard-backend"]