Skip to content

Commit

Permalink
Merge pull request #38 from GonzaloEBaez/bugfix/deploy-continuo
Browse files Browse the repository at this point in the history
Bugfix/deploy continuo
  • Loading branch information
GonzaloEBaez authored Jun 15, 2024
2 parents 8dfa750 + d1cee04 commit 058b499
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 23 deletions.
35 changes: 25 additions & 10 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
# Ignorar archivos y directorios generados durante el desarrollo
*.pyc
__pycache__
# Ignorar archivos de configuración local
# Archivos sensibles
.env
config/local_config.py
# Ignorar archivos de git
*.key
*.pem

# Archivos de control de versiones
.git
.gitignore
# Ignorar archivos Logs o Temporales
logs/
tmp/
.hg

# Archivos temporales y de compilación
_pycache_
*.pyc
*.pyo
*.log

# Copias de seguridad y archivos temporales de editores
*.bak
*.swp

# Documentación y otros archivos no necesarios
README.md
docs/

# Archivos de desarrollo local
.vscode/
.idea/
tests/
28 changes: 16 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
# Utilizamos una imagen base adecuada para nuestra aplicación. En este caso, usaremos una imagen de Python.
FROM python:3.10-slim
FROM python:3.11-slim as builder

# Establecemos el directorio de trabajo dentro del contenedor
WORKDIR /app

# Copiamos el archivo de requerimientos de Python
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

COPY requirements.txt .

# Instalamos las dependencias de la aplicación
RUN pip install --no-cache-dir -r requirements.txt
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /app/wheels -r requirements.txt

FROM python:3.11-slim

WORKDIR /app

COPY --from=builder /app/wheels /wheels
COPY --from=builder /app/requirements.txt .

RUN pip install --no-cache /wheels/*

# Copiamos el código fuente de la aplicación al contenedor
COPY . .

# Aplicamos migraciones
RUN python manage.py migrate
RUN ["python", "manage.py", "migrate"]

# Exponemos el puerto en el que se ejecuta la aplicación
EXPOSE 8000

# Comando para ejecutar la aplicación
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
CMD ["gunicorn", "--bind", ":8000", "--workers", "2", "vetsoft.wsgi"]
4 changes: 3 additions & 1 deletion vetsoft/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@

ALLOWED_HOSTS = ['vet-soft-1-4.onrender.com','100.20.92.101','44.225.181.72','44.227.217.144','127.0.0.1']

CSRF_TRUSTED_ORIGINGS = ['https://vet-soft-1-4.onrender.com']
CSRF_TRUSTED_ORIGINS = [
'https://vet-soft-1-4.onrender.com',
]
# Application definition

INSTALLED_APPS = [
Expand Down

0 comments on commit 058b499

Please sign in to comment.