blog/backend/Dockerfile
SquidSpirit 0f4033aefc
All checks were successful
Frontend CI / build (push) Successful in 1m4s
PR Title Check / pr-title-check (pull_request) Successful in 17s
BLOG-65 feat: update Dockerfiles and environment configuration for database and API integration
2025-07-24 02:16:42 +08:00

23 lines
578 B
Docker

FROM rust:1-slim AS base
RUN apt update -qq && apt install -y -qq --no-install-recommends musl-tools
RUN rustup target add x86_64-unknown-linux-musl
FROM base AS builder
WORKDIR /app
COPY . .
RUN cargo build --release --target x86_64-unknown-linux-musl
FROM alpine:latest AS runner
WORKDIR /app
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/server .
EXPOSE 8080
ENV RUST_LOG=info
ENV HOST=0.0.0.0
ENV PORT=8080
ENV DATABASE_HOST=127.0.0.1
ENV DATABASE_PORT=5432
ENV DATABASE_USER=postgres
ENV DATABASE_PASSWORD=
ENV DATABASE_NAME=postgres
CMD ["./server"]