Update Dockerfile
Browse files- Dockerfile +24 -7
Dockerfile
CHANGED
|
@@ -1,17 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
WORKDIR /code
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
COPY requirements.txt
|
| 7 |
-
RUN pip install
|
| 8 |
|
| 9 |
-
#
|
| 10 |
-
COPY .
|
|
|
|
| 11 |
|
| 12 |
-
#
|
| 13 |
EXPOSE 7860
|
| 14 |
|
| 15 |
-
# Comando para iniciar o Flask
|
| 16 |
CMD ["python", "app.py"]
|
| 17 |
|
|
|
|
| 1 |
+
# Etapa 1: Build do frontend com Vite (Node.js)
|
| 2 |
+
FROM node:20 as frontend
|
| 3 |
+
|
| 4 |
+
WORKDIR /app
|
| 5 |
+
|
| 6 |
+
# Copiar apenas o necessário para o build
|
| 7 |
+
COPY package.json vite.config.ts tsconfig.json tailwind.config.js postcss.config.js ./
|
| 8 |
+
COPY public ./public
|
| 9 |
+
COPY components ./components
|
| 10 |
+
COPY services ./services
|
| 11 |
+
COPY lib ./lib
|
| 12 |
+
COPY App.tsx index.html index.tsx types.ts ./
|
| 13 |
+
|
| 14 |
+
RUN npm install
|
| 15 |
+
RUN npm run build
|
| 16 |
+
|
| 17 |
+
# Etapa 2: Backend com Flask
|
| 18 |
FROM python:3.10-slim
|
| 19 |
|
| 20 |
WORKDIR /code
|
| 21 |
|
| 22 |
+
# Instalar dependências Python
|
| 23 |
+
COPY requirements.txt ./
|
| 24 |
+
RUN pip install -r requirements.txt
|
| 25 |
|
| 26 |
+
# Copiar backend e build do frontend
|
| 27 |
+
COPY app.py ./
|
| 28 |
+
COPY --from=frontend /app/dist ./dist
|
| 29 |
|
| 30 |
+
# Expõe a porta
|
| 31 |
EXPOSE 7860
|
| 32 |
|
|
|
|
| 33 |
CMD ["python", "app.py"]
|
| 34 |
|