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
2 changes: 1 addition & 1 deletion backend/.python-version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
3.8.10
3.11.0

15 changes: 9 additions & 6 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04
FROM python:3.11-slim

# Set environment variables
ENV DATABASE_URL="postgresql://projecthub:password123@db:5432/projecthub"
Expand All @@ -10,12 +10,15 @@ EXPOSE 5000 8000 9000

# Install system dependencies
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
postgresql-client \
libpq-dev \
netcat \
netcat-openbsd \
dos2unix \
gcc \
g++ \
libxml2-dev \
libxslt1-dev \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*

# Set working directory
Expand All @@ -25,8 +28,8 @@ WORKDIR /app
COPY requirements.txt .

# Upgrade pip and install Python dependencies
RUN pip3 install --upgrade pip setuptools wheel && \
pip3 install --no-cache-dir -r requirements.txt
RUN pip install --upgrade pip setuptools wheel && \
pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY . .
Expand Down
4 changes: 2 additions & 2 deletions backend/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ attempt=0

while [ $attempt -lt $max_attempts ]; do
# Try connecting with netcat or python
if nc -z $DB_HOST 5432 2>/dev/null || python3 -c "import socket; socket.create_connection(('$DB_HOST', 5432), timeout=2)" 2>/dev/null; then
if nc -z $DB_HOST 5432 2>/dev/null || python -c "import socket; socket.create_connection(('$DB_HOST', 5432), timeout=2)" 2>/dev/null; then
echo "PostgreSQL is ready on $DB_HOST!"
break
fi
Expand All @@ -26,5 +26,5 @@ if [ $attempt -eq $max_attempts ]; then
fi

# Start the application
exec python3 app.py
exec python app.py

15 changes: 8 additions & 7 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
Flask==1.1.4
Flask-SQLAlchemy==2.3.2
SQLAlchemy==1.4.0
Flask-CORS==3.0.7
Flask-CORS==4.0.0
Flask-JWT-Extended==3.13.1
psycopg2-binary==2.7.4
PyJWT==1.6.4
psycopg2-binary==2.9.9
PyJWT==2.8.0
Werkzeug==1.0.1
python-dotenv==0.10.0
requests==2.20.0
lxml==4.2.5
Pillow==5.2.0
python-magic==0.4.15
PyYAML==3.13
lxml==4.9.3
Pillow==10.0.0
python-magic==0.4.27
PyYAML==6.0.1
Jinja2==2.11.3
MarkupSafe==2.0.1