From 1886ab60941dcdd6a83358af929ae710d34ca1e0 Mon Sep 17 00:00:00 2001 From: Alan Alonso Date: Sat, 23 May 2026 01:06:30 -0600 Subject: [PATCH] feat: add Docker and Railway deployment config --- Dockerfile | 25 +++++++++++++++++++++++++ railway.json | 13 +++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 Dockerfile create mode 100644 railway.json 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" + ] +}