From 2de44782f7b027b9d79f6e6159649840c050b93f Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 13 Dec 2023 10:45:07 +0530 Subject: [PATCH] Add nginx postgres files --- nginx/Dockerfile | 11 +++++++++++ nginx/nginx.conf | 18 ++++++++++++++++++ postgres/Dockerfile | 9 +++++++++ 3 files changed, 38 insertions(+) create mode 100644 nginx/Dockerfile create mode 100644 nginx/nginx.conf create mode 100644 postgres/Dockerfile diff --git a/nginx/Dockerfile b/nginx/Dockerfile new file mode 100644 index 0000000..3548e84 --- /dev/null +++ b/nginx/Dockerfile @@ -0,0 +1,11 @@ +# Use the official Nginx image from the Docker Hub +FROM nginx:latest + +# Copy custom configuration file to Nginx configuration directory +COPY ./nginx/nginx.conf /etc/nginx/nginx.conf + +# Expose port +EXPOSE 80 + +# Start Nginx +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..fbd7119 --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,18 @@ +# nginx.conf + +# Default server configuration +server { + listen 80; + server_name localhost; + + location / { + # Forward requests to the uWSGI server + uwsgi_pass unix:/app/myapp.sock; + include /etc/nginx/uwsgi_params; + } + + location /static/ { + # Serve static files from the Django app + alias /app/static/; + } +} diff --git a/postgres/Dockerfile b/postgres/Dockerfile new file mode 100644 index 0000000..effc3e0 --- /dev/null +++ b/postgres/Dockerfile @@ -0,0 +1,9 @@ +# Use the official PostgreSQL image from the Docker Hub +FROM postgres:latest + +# Copy custom configuration file to PostgreSQL configuration directory +COPY ./postgres/postgresql.conf /etc/postgresql/postgresql.conf + +# Set the Unix socket directory +RUN echo "unix_socket_directories = '/var/run/postgresql'" >> /etc/postgresql/postgresql.conf +