feat(docker): enhance Dockerfile with debugging outputs and install tree utility; update .dockerignore and MANIFEST.in for better packaging

This commit is contained in:
pacnpal
2025-01-28 22:36:22 -05:00
parent 64d09b8842
commit 0bc9dded41
6 changed files with 107 additions and 57 deletions

View File

@@ -12,6 +12,7 @@ RUN apt-get update && \
libc6-dev \
python3-dev \
python3-pip \
tree \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& python3 -m pip install --no-cache-dir --upgrade "pip>=21.3" setuptools wheel
@@ -26,23 +27,27 @@ RUN mkdir -p /app/src/simpleguardhome && \
# Copy source code, maintaining directory structure
COPY . /app/
# Set execute permission for entrypoint script
RUN chmod +x /app/docker-entrypoint.sh && \
# Debug: Show the copied files and set execute permission for entrypoint script
RUN echo "Project structure:" && \
tree /app && \
echo "Package directory contents:" && \
ls -la /app/src/simpleguardhome/ && \
chmod +x /app/docker-entrypoint.sh && \
cp /app/docker-entrypoint.sh /usr/local/bin/
# Set PYTHONPATH
ENV PYTHONPATH=/app/src
# Install Python requirements
RUN pip install --no-cache-dir -r requirements.txt
# Install and verify the package
RUN set -e && \
# Install Python requirements and verify the package
RUN pip install --no-cache-dir -r requirements.txt && \
set -e && \
echo "Installing package..." && \
pip uninstall -y simpleguardhome || true && \
# Verify source files exist
echo "Verifying source files..." && \
ls -la /app/src/simpleguardhome/ && \
# Debug: Show package files
echo "Python path:" && \
python3 -c "import sys; print('\n'.join(sys.path))" && \
echo "Source directory contents:" && \
ls -R /app/src && \
# Install package in editable mode with compatibility mode enabled
pip install --use-pep517 -e . --config-settings editable_mode=compat && \
echo "Verifying installation..." && \
@@ -50,13 +55,15 @@ RUN set -e && \
# List all package files
echo "Package contents:" && \
find /app/src/simpleguardhome -type f -ls && \
# Verify import works
# Verify package can be imported
echo "Testing import..." && \
python3 -c "import simpleguardhome; from simpleguardhome.main import app; print(f'Package found at: {simpleguardhome.__file__}')" && \
echo "Package installation successful"
# Create rules backup directory with proper permissions
RUN mkdir -p /app/rules_backup && \
python3 -c "import simpleguardhome; print(f'Package found at: {simpleguardhome.__file__}')" && \
# Verify app can be imported
echo "Testing app import..." && \
python3 -c "from simpleguardhome.main import app; print('App imported successfully')" && \
echo "Package installation successful" && \
# Create rules backup directory with proper permissions
mkdir -p /app/rules_backup && \
chmod 777 /app/rules_backup
# Default environment variables