refactor(docker): restructure Dockerfile to copy source code directory and create rules_backup volume

This commit is contained in:
pacnpal
2025-01-29 09:42:37 -05:00
parent 6baa26eb80
commit ceee425fab
2 changed files with 10 additions and 4 deletions

View File

@@ -14,7 +14,10 @@ COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy source code
COPY src/simpleguardhome /app/simpleguardhome/
COPY src /app/src
# Create rules_backup directory with proper permissions
RUN mkdir -p rules_backup && chmod 777 rules_backup
# Set up health check
COPY healthcheck.py /usr/local/bin/
@@ -35,3 +38,6 @@ COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["docker-entrypoint.sh"]
# Mark rules_backup as a volume
VOLUME ["/app/rules_backup"]

View File

@@ -3,5 +3,5 @@ set -e
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting SimpleGuardHome..."
# Start the application
exec python3 -m uvicorn simpleguardhome.main:app --host 0.0.0.0 --port 8000
# Run the app with src in Python path to find the module
PYTHONPATH=/app/src exec python3 -m uvicorn simpleguardhome.main:app --host 0.0.0.0 --port 8000