Agregar docker-compose y Dockerfiles para EasyPanel
This commit is contained in:
8
backend/.dockerignore
Normal file
8
backend/.dockerignore
Normal file
@@ -0,0 +1,8 @@
|
||||
__pycache__/
|
||||
*.pyc
|
||||
.env
|
||||
*.xlsx
|
||||
*.csv
|
||||
*.json
|
||||
venv/
|
||||
.venv/
|
||||
27
backend/Dockerfile
Normal file
27
backend/Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Dependencias del sistema necesarias para pyodbc (SQL Server) y psycopg2
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc \
|
||||
g++ \
|
||||
unixodbc \
|
||||
unixodbc-dev \
|
||||
curl \
|
||||
gnupg \
|
||||
&& curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
|
||||
&& curl https://packages.microsoft.com/config/debian/12/prod.list > /etc/apt/sources.list.d/mssql-release.list \
|
||||
&& apt-get update \
|
||||
&& ACCEPT_EULA=Y apt-get install -y --no-install-recommends msodbcsql18 \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 8001
|
||||
|
||||
CMD ["python", "main.py"]
|
||||
45
docker-compose.yml
Normal file
45
docker-compose.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
services:
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8001:8001"
|
||||
environment:
|
||||
- PG_HOST=${PG_HOST}
|
||||
- PG_DATABASE=${PG_DATABASE}
|
||||
- PG_USER=${PG_USER}
|
||||
- PG_PASSWORD=${PG_PASSWORD}
|
||||
- PG_PORT=${PG_PORT}
|
||||
- SQL_SERVER=${SQL_SERVER}
|
||||
- SQL_DATABASE=${SQL_DATABASE}
|
||||
- SQL_USERNAME=${SQL_USERNAME}
|
||||
- SQL_PASSWORD=${SQL_PASSWORD}
|
||||
- GITHUB_BASE=${GITHUB_BASE}
|
||||
- SUPABASE_URL=${SUPABASE_URL}
|
||||
- SUPABASE_KEY=${SUPABASE_KEY}
|
||||
- SUPABASE_TABLA_LEADS=${SUPABASE_TABLA_LEADS}
|
||||
- SUPABASE_PAUTA_URL=${SUPABASE_PAUTA_URL}
|
||||
- SUPABASE_PAUTA_KEY=${SUPABASE_PAUTA_KEY}
|
||||
- SUPABASE_TABLA_PAUTA=${SUPABASE_TABLA_PAUTA}
|
||||
- CARTERA_URL=${CARTERA_URL}
|
||||
- CARTERA_KEY=${CARTERA_KEY}
|
||||
- SUPABASE_TABLA_CARTERA=${SUPABASE_TABLA_CARTERA}
|
||||
- SUPABASE_TABLA_ALIAS=${SUPABASE_TABLA_ALIAS}
|
||||
- SUPABASE_TABLA_CONJUNTO=${SUPABASE_TABLA_CONJUNTO}
|
||||
- META_CSV_URL=${META_CSV_URL}
|
||||
- PORT=8001
|
||||
- CORS_ORIGINS=${CORS_ORIGINS:-*}
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
- VITE_API_URL=${VITE_API_URL}
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:80"
|
||||
depends_on:
|
||||
- backend
|
||||
4
frontend/.dockerignore
Normal file
4
frontend/.dockerignore
Normal file
@@ -0,0 +1,4 @@
|
||||
node_modules/
|
||||
dist/
|
||||
.vite/
|
||||
.env
|
||||
22
frontend/Dockerfile
Normal file
22
frontend/Dockerfile
Normal file
@@ -0,0 +1,22 @@
|
||||
# --- Etapa 1: build de la app React/Vite ---
|
||||
FROM node:20-alpine AS build
|
||||
WORKDIR /app
|
||||
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
|
||||
COPY . .
|
||||
|
||||
# VITE_API_URL debe pasarse como build-arg / env en el momento del build,
|
||||
# ya que Vite la "quema" dentro del bundle estatico.
|
||||
ARG VITE_API_URL
|
||||
ENV VITE_API_URL=$VITE_API_URL
|
||||
|
||||
RUN npm run build
|
||||
|
||||
# --- Etapa 2: servir los archivos estaticos con nginx ---
|
||||
FROM nginx:alpine
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 80
|
||||
14
frontend/nginx.conf
Normal file
14
frontend/nginx.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Soporte para rutas de SPA (React Router / navegacion interna)
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
}
|
||||
Reference in New Issue
Block a user