feat: add Docker and Railway deployment config
This commit is contained in:
25
Dockerfile
Normal file
25
Dockerfile
Normal file
@@ -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"]
|
||||||
13
railway.json
Normal file
13
railway.json
Normal file
@@ -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"
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user