File size: 1,435 Bytes
bbb1195 f24a145 bbb1195 7881083 bbb1195 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | # ============================================
# Multi-stage Dockerfile for Antigravity API Proxy
# For deployment to HuggingFace Spaces
# ============================================
# Stage 1: Build Frontend
FROM node:20-alpine AS frontend-builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --legacy-peer-deps
COPY . .
RUN npm run build
# Stage 2: Build Backend
FROM rust:1.83-slim AS backend-builder
RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy server source
COPY server/ ./
# Build release binary
RUN cargo build --release
# Stage 3: Runtime
FROM debian:bookworm-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user (required by HuggingFace Spaces)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user
WORKDIR $HOME/app
# Copy backend binary
COPY --chown=user --from=backend-builder /app/target/release/antigravity-server ./
# Copy frontend static files
COPY --chown=user --from=frontend-builder /app/dist ./static
# Create data directory with accounts subdirectory
RUN mkdir -p /home/user/app/data/accounts
# Expose port
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:7860/healthz || exit 1
# Run the server
CMD ["./antigravity-server"]
|