1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-20 21:39:37 +02:00
AdventureLog/backend/Dockerfile

49 lines
1.3 KiB
Text
Raw Normal View History

2024-10-25 22:57:10 -04:00
# Use the official Python slim image as the base image
2024-07-08 11:44:39 -04:00
FROM python:3.10-slim
LABEL Developers="Sean Morley"
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Set the working directory
WORKDIR /code
2024-10-25 22:57:10 -04:00
# Install system dependencies (Nginx included)
2024-07-08 11:44:39 -04:00
RUN apt-get update \
&& apt-get install -y git postgresql-client gdal-bin libgdal-dev nginx supervisor \
2024-11-05 11:15:57 -05:00
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
2024-07-08 11:44:39 -04:00
# Install Python dependencies
COPY ./server/requirements.txt /code/
2024-11-05 11:15:57 -05:00
RUN pip install --upgrade pip \
&& pip install -r requirements.txt
# Create necessary directories
RUN mkdir -p /code/static /code/media
2024-11-05 14:07:12 -05:00
# RUN mkdir -p /code/staticfiles /code/media
2024-07-08 11:44:39 -04:00
# Copy the Django project code into the Docker image
COPY ./server /code/
2024-10-25 22:57:10 -04:00
# Copy Nginx configuration
COPY ./nginx.conf /etc/nginx/nginx.conf
# Copy Supervisor configuration
COPY ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf
2024-08-20 14:37:18 -04:00
# Collect static files
RUN python3 manage.py collectstatic --noinput --verbosity 2
2024-07-08 11:44:39 -04:00
# Set the entrypoint script
COPY ./entrypoint.sh /code/entrypoint.sh
RUN chmod +x /code/entrypoint.sh
2024-10-25 22:57:10 -04:00
# Expose ports for NGINX and Gunicorn
EXPOSE 80 8000
# Command to start Supervisor (which starts Nginx and Gunicorn)
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]