feat: add Docker support with Dockerfile and docker-compose, update API URLs to use base_url
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
# ── Stage 1: builder ──────────────────────────────────────────────────────────
|
||||
FROM rust:1.88-slim-bookworm AS builder
|
||||
|
||||
# Build dependencies for native libs (OpenSSL via rustls not needed, but sqlx needs pkg-config)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
pkg-config \
|
||||
libssl-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Cache dependency compilation separately from source
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
|
||||
# Create a dummy main so Cargo can compile deps without our source
|
||||
RUN mkdir src && echo "fn main() {}" > src/main.rs
|
||||
RUN cargo build --release --bin meowspool 2>/dev/null; true
|
||||
|
||||
# Now copy real source and migrations
|
||||
COPY src ./src
|
||||
COPY migrations ./migrations
|
||||
|
||||
# Touch main.rs so Cargo knows it changed, then build for real
|
||||
RUN touch src/main.rs && cargo build --release --bin meowspool
|
||||
|
||||
# ── Stage 2: runtime ──────────────────────────────────────────────────────────
|
||||
FROM debian:bookworm-slim AS runtime
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/target/release/meowspool ./meowspool
|
||||
COPY --from=builder /app/migrations ./migrations
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["./meowspool"]
|
||||
Reference in New Issue
Block a user