# Etapa 1: Build do frontend com Vite (Node.js) | |
FROM node:20 as frontend | |
WORKDIR /app | |
# Copiar apenas o necessário para o build | |
COPY package.json vite.config.ts tsconfig.json tailwind.config.js postcss.config.js ./ | |
COPY public ./public | |
COPY components ./components | |
COPY services ./services | |
COPY lib ./lib | |
COPY App.tsx index.html index.tsx types.ts ./ | |
RUN npm install | |
RUN npm run build | |
# Etapa 2: Backend com Flask | |
FROM python:3.10-slim | |
WORKDIR /code | |
# Instalar dependências Python | |
COPY requirements.txt ./ | |
RUN pip install -r requirements.txt | |
# Copiar backend e build do frontend | |
COPY app.py ./ | |
COPY --from=frontend /app/dist ./dist | |
# Expõe a porta | |
EXPOSE 7860 | |
CMD ["python", "app.py"] | |