Spaces:
Sleeping
Sleeping
File size: 2,817 Bytes
719711d b379f3f 719711d c5d5cd5 719711d c5d5cd5 719711d c5d5cd5 719711d c5d5cd5 719711d c5d5cd5 719711d c5d5cd5 719711d c5d5cd5 719711d c5d5cd5 719711d b379f3f | 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 59 60 61 62 63 64 65 66 67 68 69 70 | # ============================================================
# Stage 1 β Build the React frontend
# ============================================================
FROM node:22-slim AS frontend-build
WORKDIR /app/frontend
# Copy package files first for better layer caching
COPY frontend/package.json frontend/package-lock.json ./
# Install dependencies
RUN npm ci --production=false
# Copy the rest of the frontend source
COPY frontend/ .
# Build-time env vars β these are PUBLIC client-side keys that get baked
# into the JS bundle. They are NOT secrets (visible in browser devtools).
ENV VITE_FIREBASE_API_KEY=AIzaSyAjBBEyjCTg813dfDxstJmw1xQ390AaEko
ENV VITE_FIREBASE_AUTH_DOMAIN=socialshareandcarengo.firebaseapp.com
ENV VITE_FIREBASE_PROJECT_ID=socialshareandcarengo
ENV VITE_FIREBASE_STORAGE_BUCKET=socialshareandcarengo.firebasestorage.app
ENV VITE_FIREBASE_MESSAGING_SENDER_ID=233936256945
ENV VITE_FIREBASE_APP_ID=1:233936256945:web:4ce50f81d085c00c1bc790
ENV VITE_FIREBASE_MEASUREMENT_ID=G-9J43PT6H4G
ENV VITE_RAZORPAY_KEY_ID=rzp_test_SKJ5P6PFqYPrNt
ENV VITE_API_URL=/api
# Build the production bundle
RUN npm run build
# ============================================================
# Stage 2 β Production Python runtime
# ============================================================
FROM python:3.11-slim
# Install curl for health-check probes
RUN apt-get update && apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# ββ Python dependencies ββββββββββββββββββββββββββββββββββββ
COPY backend/requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# ββ Backend source code ββββββββββββββββββββββββββββββββββββ
COPY backend/ ./backend/
# ββ Built frontend (from Stage 1) ββββββββββββββββββββββββββ
COPY --from=frontend-build /app/frontend/dist ./frontend/dist
# ββ Expose a single port βββββββββββββββββββββββββββββββββββ
ENV PORT=7860
EXPOSE 7860
# ββ Health check βββββββββββββββββββββββββββββββββββββββββββ
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:7860/api/health || exit 1
# ββ Start with Gunicorn (production WSGI server) ββββββββββ
CMD ["gunicorn", \
"--bind", "0.0.0.0:7860", \
"--workers", "4", \
"--timeout", "120", \
"--access-logfile", "-", \
"--error-logfile", "-", \
"--chdir", "/app/backend", \
"app:app"] |