forked from frlp-utn-ingsoft/vetsoft
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modifico Dockerfile para mejores practicas
- Loading branch information
1 parent
933388f
commit 651b940
Showing
1 changed file
with
16 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |