Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM python:3.11-slim

ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1

WORKDIR /app

RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
RUN pip install --upgrade pip
RUN pip install -r requirements.txt

COPY . .

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
14 changes: 14 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.9'

services:
django-app:
build: .
container_name: django_app
ports:
- "${PORT:-8000}:8000"
env_file:
- ./warehouse_managment/warehouse_managment/.env

Copilot AI May 10, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker-compose.yaml references './warehouse_managment/warehouse_managment/.env', but the added file is '.env.example'. This mismatch may cause missing environment variables at runtime. Consider updating the file reference or renaming the file accordingly.

Suggested change
- ./warehouse_managment/warehouse_managment/.env
- ./warehouse_managment/warehouse_managment/.env.example

Copilot uses AI. Check for mistakes.
volumes:
- .:/app
working_dir: /app/warehouse_managment
restart: unless-stopped
10 changes: 10 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

echo "⚙️ Applying migrations..."
python manage.py migrate

echo "📦 PORT from .env is: $PORT"

PORT=${PORT:-8000}
Comment on lines +6 to +8

Copilot AI May 10, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The default port assignment occurs after logging the current value, which may lead to confusing output. Consider moving the default assignment before the log statement to ensure consistency.

Suggested change
echo "📦 PORT from .env is: $PORT"
PORT=${PORT:-8000}
PORT=${PORT:-8000}
echo "📦 PORT from .env is: $PORT"

Copilot uses AI. Check for mistakes.
echo "🚀 Starting Django server on port $PORT..."
python manage.py runserver 0.0.0.0:$PORT
1 change: 1 addition & 0 deletions warehouse_managment/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PORT=8003
12 changes: 12 additions & 0 deletions warehouse_managment/warehouse_managment/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Django
DJANGO_SECRET_KEY=your-secret-key-here
DJANGO_DEBUG=True
DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1

Copilot AI May 10, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] If the Postgres settings are intended to be used, consider adding guidance on when to uncomment these lines or updating the example to clarify their usage.

Suggested change
# Uncomment the following lines to configure a Postgres database connection.
# These settings are used if DATABASE_URL is not provided or if the application explicitly supports them.

Copilot uses AI. Check for mistakes.
# POSTGRES_DB=warehouse_inventory
# POSTGRES_USER=admin
# POSTGRES_PASSWORD=admin
# POSTGRES_PORT=5432
# POSTGRES_HOST=localhost

DATABASE_URL=your_db_url
Loading