updated whit entrypoint
This commit is contained in:
@@ -15,6 +15,10 @@ RUN rustc --version && cargo --version
|
|||||||
# Copy application files
|
# Copy application files
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
|
||||||
|
# Copy entrypoint script and make it executable
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
# Upgrade pip and install Python dependencies (using piwheels for ARM)
|
# Upgrade pip and install Python dependencies (using piwheels for ARM)
|
||||||
RUN python -m pip install --upgrade pip && \
|
RUN python -m pip install --upgrade pip && \
|
||||||
pip install --no-cache-dir --extra-index-url https://www.piwheels.org/simple -r requirements.txt
|
pip install --no-cache-dir --extra-index-url https://www.piwheels.org/simple -r requirements.txt
|
||||||
@@ -22,5 +26,5 @@ RUN python -m pip install --upgrade pip && \
|
|||||||
# Expose the application port
|
# Expose the application port
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|
||||||
# Start the application
|
# Use entrypoint script
|
||||||
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5000", "app:app"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
image: digi-server:latest
|
image: digiserver:latest
|
||||||
ports:
|
ports:
|
||||||
- "80:5000"
|
- "8880:5000"
|
||||||
environment:
|
environment:
|
||||||
- FLASK_APP=app.py
|
- FLASK_APP=app.py
|
||||||
- FLASK_RUN_HOST=0.0.0.0
|
- FLASK_RUN_HOST=0.0.0.0
|
||||||
@@ -14,5 +12,4 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- /home/pi/Desktop/digi-server/db:/app/instance
|
- /home/pi/Desktop/digi-server/db:/app/instance
|
||||||
- /home/pi/Desktop/digi-server/static:/app/static/uploads
|
- /home/pi/Desktop/digi-server/static:/app/static/uploads
|
||||||
command: gunicorn -w 4 -b 0.0.0.0:5000 app:app
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
11
entrypoint.sh
Normal file
11
entrypoint.sh
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# filepath: /home/ske087/digiserver/entrypoint.sh
|
||||||
|
|
||||||
|
# Initialize the database if it doesn't exist
|
||||||
|
if [ ! -f "/app/instance/dashboard.db" ]; then
|
||||||
|
echo "Initializing database..."
|
||||||
|
python init_db.py
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start Gunicorn
|
||||||
|
exec gunicorn -w 4 -b 0.0.0.0:5000 app:app
|
||||||
Reference in New Issue
Block a user