Move django dockerfile to the app
This commit is contained in:
parent
264745f40f
commit
341de7596e
2 changed files with 22 additions and 26 deletions
26
Dockerfile
26
Dockerfile
|
@ -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"]
|
||||
|
22
dynamicweb2/Dockerfile
Normal file
22
dynamicweb2/Dockerfile
Normal file
|
@ -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"]
|
Loading…
Reference in a new issue