app-lookup / Dockerfile
lljz66's picture
Upload Dockerfile
a487b64 verified
Raw
History Blame Contribute Delete
811 Bytes
# Stage 1: Build
FROM rust:latest AS builder
WORKDIR /app
# Copy manifests first for dependency caching
COPY Cargo.toml ./
RUN mkdir -p src && echo "fn main() {}" > src/main.rs
# Generate lockfile if missing, then build deps
RUN if [ ! -f Cargo.lock ]; then cargo generate-lockfile; fi
RUN cargo build --release 2>/dev/null || true
RUN rm -rf src
# Now build the real binary
COPY src/ src/
RUN cargo build --release
# Stage 2: Runtime
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates libc6 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/target/release/app-lookup .
COPY static/ static/
EXPOSE 7860
ENV APP_HOST=0.0.0.0
ENV APP_PORT=7860
ENV APP_LOG_LEVEL=info
ENV APP_HTTP_TIMEOUT_SECS=15
CMD ["./app-lookup"]