From 341de7596e55580f2bea1f6add4b81e4702e3d10 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 13 Dec 2023 10:41:01 +0530 Subject: [PATCH] Move django dockerfile to the app --- Dockerfile | 26 -------------------------- dynamicweb2/Dockerfile | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 26 deletions(-) delete mode 100644 Dockerfile create mode 100644 dynamicweb2/Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 2351cd8..0000000 --- a/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -# Use the official Python image from the Docker Hub -FROM python:3.10.6 - -# Set environment variables -ENV PYTHONDONTWRITEBYTECODE 1 -ENV PYTHONUNBUFFERED 1 - -# Set the working directory in the container -WORKDIR /app - -# Copy the requirements file to the working directory -COPY requirements.txt /app/ - -# Install dependencies -RUN pip install --upgrade pip -RUN pip install -r requirements.txt - -# Copy the entire project to the working directory in the container -COPY . /app/ - -# Expose the port the app runs on -EXPOSE 8000 - -# Command to run the application -CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] - diff --git a/dynamicweb2/Dockerfile b/dynamicweb2/Dockerfile new file mode 100644 index 0000000..7ba8cc3 --- /dev/null +++ b/dynamicweb2/Dockerfile @@ -0,0 +1,22 @@ +# Base image +FROM python:3.10.6 + +# Set environment variables +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +# Set working directory +WORKDIR /app + +# Copy and install requirements +COPY ./requirements.txt /app/requirements.txt +RUN pip install -r requirements.txt + +# Copy the project files into the working directory +COPY . /app/ + +# Collect static files +RUN python manage.py collectstatic --noinput + +# Run uWSGI with Unix socket +CMD ["uwsgi", "--socket", ":8000", "--module", "myapp.wsgi:application"]