diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..22b9258 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM python:3.11-slim + +WORKDIR /app + +# Copiar requirements +COPY server/requirements.txt . + +# Instalar dependencias +RUN pip install --no-cache-dir -r requirements.txt + +# Copiar app +COPY server/app ./app + +# Copiar config +COPY server/.env.example ./app/.env + +# Exponer puerto +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ + CMD python -c "import requests; requests.get('http://localhost:8000/health')" + +# Correr app +CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] diff --git a/railway.json b/railway.json new file mode 100644 index 0000000..5fe5d57 --- /dev/null +++ b/railway.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://railway.app/railway.schema.json", + "build": { + "builder": "dockerfile" + }, + "deploy": { + "numReplicas": 1, + "startCommand": "python -m uvicorn app.main:app --host 0.0.0.0 --port $PORT" + }, + "plugins": [ + "postgresql" + ] +}