fixed errors
Browse filesFiles changed (4)
- Dockerfile+3-3
- README.md+23
- docker-compose.yml+4-4
- start.shAdded+36
43 unmodified lines444546474849501 unmodified line525354555643 unmodified linesCOPY --chown=appuser:appuser . .# Make scripts executableRUN chmod +x /app/prestart.sh /app/healthcheck.sh# Switch to non-root userUSER appuser1 unmodified line# Expose the portEXPOSE 5000# Run the prestart script and then start the applicationCMD ["/bin/bash", "-c", "/app/prestart.sh && gunicorn --config=./gunicorn.conf.py --workers=2 app:create_app()"]43 unmodified lines444546474849501 unmodified line525354555643 unmodified linesCOPY --chown=appuser:appuser . .# Make scripts executableRUN chmod +x /app/prestart.sh /app/healthcheck.sh /app/start.sh# Switch to non-root userUSER appuser1 unmodified line# Expose the portEXPOSE 5000# Run the startup scriptCMD ["/app/start.sh"]
91 unmodified lines92939495969725 unmodified lines12312412512612712891 unmodified linesdocker-compose up -d```## Troubleshooting### Missing Dependencies25 unmodified linespip install torch==2.0.1```## TestingRun the test suite:```bash91 unmodified lines929394959697989925 unmodified lines12512612712812913013113213313413513613713813914014114214314414514614714814915015191 unmodified linesdocker-compose up -d```If you don't have a .env file, default development values will be used, but you should create one for production.## Troubleshooting### Missing Dependencies25 unmodified linespip install torch==2.0.1```#### Docker Startup IssuesIf you encounter issues with Docker startup:1. Check if the scripts are executable:```bashchmod +x prestart.sh start.sh healthcheck.sh```2. Verify the Docker logs:```bashdocker-compose logs web```3. Try rebuilding the Docker image:```bashdocker-compose build --no-cache webdocker-compose up -d```4. If you see syntax errors with parentheses, ensure the start.sh script is properly formatted and executable.## TestingRun the test suite:```bash
10 unmodified lines111213141516171818 unmodified lines373839404142434410 unmodified lines- CELERY_BROKER_URL=redis://redis:6379/0- CELERY_RESULT_BACKEND=redis://redis:6379/0- INSTANCE_PATH=/tmp/instance- SECRET_KEY=${SECRET_KEY}- OPENAI_API_KEY=${OPENAI_API_KEY}volumes:- ./app:/app/app- ./app/models:/app/models18 unmodified lines- CELERY_BROKER_URL=redis://redis:6379/0- CELERY_RESULT_BACKEND=redis://redis:6379/0- INSTANCE_PATH=/tmp/instance- SECRET_KEY=${SECRET_KEY}- OPENAI_API_KEY=${OPENAI_API_KEY}volumes:- ./app:/app/appdepends_on:10 unmodified lines111213141516171818 unmodified lines373839404142434410 unmodified lines- CELERY_BROKER_URL=redis://redis:6379/0- CELERY_RESULT_BACKEND=redis://redis:6379/0- INSTANCE_PATH=/tmp/instance- SECRET_KEY=${SECRET_KEY:-default-dev-key-change-in-production}- OPENAI_API_KEY=${OPENAI_API_KEY:-sk-mock-key-for-development}volumes:- ./app:/app/app- ./app/models:/app/models18 unmodified lines- CELERY_BROKER_URL=redis://redis:6379/0- CELERY_RESULT_BACKEND=redis://redis:6379/0- INSTANCE_PATH=/tmp/instance- SECRET_KEY=${SECRET_KEY:-default-dev-key-change-in-production}- OPENAI_API_KEY=${OPENAI_API_KEY:-sk-mock-key-for-development}volumes:- ./app:/app/appdepends_on:
123456789101112131415161718192021222324252627282930313233343536#!/bin/bash# start.sh - Application startup script
set -e # Exit immediately if a command exits with a non-zero status
echo "===== Starting Application at $(date -u '+%Y-%m-%d %H:%M:%S') ====="
# Run prestart script to check dependenciesif [ -f /app/prestart.sh ]; then echo "Running prestart script..." /app/prestart.sh if [ $? -ne 0 ]; then echo "Error: Prestart script failed. Exiting." exit 1 fielse echo "Warning: Prestart script not found."fi
# Check if gunicorn is installedif ! command -v gunicorn &> /dev/null; then echo "Error: gunicorn is not installed. Installing..." pip install --no-cache-dir gunicornfi
# Check if gunicorn config existsif [ ! -f ./gunicorn.conf.py ]; then echo "Warning: gunicorn.conf.py not found. Using default configuration." GUNICORN_OPTS="--workers=2 --bind=0.0.0.0:5000"else GUNICORN_OPTS="--config=./gunicorn.conf.py --workers=2"fi
# Start gunicornecho "Starting gunicorn..."exec gunicorn $GUNICORN_OPTS "app:create_app()" Dockerfile+3-3
README.md+23
docker-compose.yml+4-4
start.shAdded+36