Commit ·
6927d56
1
Parent(s): 318e176
fix: Set PYTHONPATH and use python -m in init script
Browse files- Dockerfile +2 -1
- scripts/init-db.sh +3 -3
Dockerfile
CHANGED
|
@@ -62,8 +62,9 @@ RUN chmod +x /app/scripts/*.sh
|
|
| 62 |
# Switch to non-root user
|
| 63 |
USER appuser
|
| 64 |
|
| 65 |
-
# Ensure user's local bin is in PATH
|
| 66 |
ENV PATH="/home/appuser/.local/bin:${PATH}"
|
|
|
|
| 67 |
|
| 68 |
# Expose port 8000
|
| 69 |
EXPOSE 8000
|
|
|
|
| 62 |
# Switch to non-root user
|
| 63 |
USER appuser
|
| 64 |
|
| 65 |
+
# Ensure user's local bin is in PATH and set PYTHONPATH
|
| 66 |
ENV PATH="/home/appuser/.local/bin:${PATH}"
|
| 67 |
+
ENV PYTHONPATH="/home/appuser/.local/lib/python3.11/site-packages"
|
| 68 |
|
| 69 |
# Expose port 8000
|
| 70 |
EXPOSE 8000
|
scripts/init-db.sh
CHANGED
|
@@ -30,8 +30,8 @@ echo "Database URL: $DATABASE_URL"
|
|
| 30 |
echo "Running database migrations..."
|
| 31 |
cd /app
|
| 32 |
|
| 33 |
-
# Always use
|
| 34 |
-
ALEMBIC_CMD="
|
| 35 |
|
| 36 |
# Check if alembic.ini exists
|
| 37 |
if [ ! -f "alembic.ini" ]; then
|
|
@@ -51,4 +51,4 @@ fi
|
|
| 51 |
# Start the FastAPI server
|
| 52 |
echo "Starting FastAPI server..."
|
| 53 |
PORT=${PORT:-8000}
|
| 54 |
-
exec
|
|
|
|
| 30 |
echo "Running database migrations..."
|
| 31 |
cd /app
|
| 32 |
|
| 33 |
+
# Always use python -m for robustness
|
| 34 |
+
ALEMBIC_CMD="python -m alembic"
|
| 35 |
|
| 36 |
# Check if alembic.ini exists
|
| 37 |
if [ ! -f "alembic.ini" ]; then
|
|
|
|
| 51 |
# Start the FastAPI server
|
| 52 |
echo "Starting FastAPI server..."
|
| 53 |
PORT=${PORT:-8000}
|
| 54 |
+
exec python -m uvicorn src.main:app --host 0.0.0.0 --port $PORT --log-level info
|