File size: 1,619 Bytes
f59c380 99af502 f59c380 512ad5f 1a73a61 f59c380 ecc5ffa f59c380 aca6b8f f59c380 | 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 | # Build Frontend
FROM node:20-slim AS frontend-builder
WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json* ./
RUN npm install
COPY frontend/ .
# Set API base to empty so it uses relative paths (handled by Nginx)
ENV NEXT_PUBLIC_API_BASE=""
ENV DATABASE_URL="sqlite:///./andesops.db"
RUN npm run build
# Final Image
FROM python:3.12-slim
WORKDIR /app
ENV DATABASE_URL="sqlite:////tmp/andesops.db"
ENV PYTHONUNBUFFERED=1
# Install Node.js (for running frontend in dev/ssr mode) and Nginx
RUN apt-get update && apt-get install -y \
curl \
nginx \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Copy Backend
COPY backend/requirements.txt ./backend/
RUN pip install --no-cache-dir -r backend/requirements.txt
# Install missing deps found earlier
# Install missing deps found earlier
RUN pip install --no-cache-dir sqlalchemy==2.0.49 pymysql cryptography pydantic-settings slowapi pypdf python-multipart
COPY backend/ ./backend/
# Copy Frontend Build
COPY --from=frontend-builder /app/frontend/.next ./frontend/.next
COPY --from=frontend-builder /app/frontend/public ./frontend/public
COPY --from=frontend-builder /app/frontend/package.json ./frontend/package.json
COPY --from=frontend-builder /app/frontend/node_modules ./frontend/node_modules
# Nginx Config
COPY nginx.conf /etc/nginx/sites-available/default
RUN ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
# Start Script
COPY start.sh .
RUN chmod +x start.sh
# Expose HF Port
EXPOSE 7860
CMD ["./start.sh"]
|