feat(docker): enhance package installation verification and streamline entrypoint script

This commit is contained in:
pacnpal
2025-01-28 21:29:23 +00:00
parent 01c0098a73
commit dfbe143d7d
3 changed files with 12 additions and 10 deletions

View File

@@ -19,14 +19,11 @@ RUN pip install --no-cache-dir -r requirements.txt
# Copy the source code # Copy the source code
COPY . . COPY . .
# Set Python path to include src directory # Clean any previous installations and install the package
ENV PYTHONPATH=/app/src RUN pip uninstall -y simpleguardhome || true && \
pip install -e . && \
# Install the package in editable mode pip show simpleguardhome && \
RUN pip install -e . python3 -c "import simpleguardhome; print('Package found at:', simpleguardhome.__file__)"
# Verify package installation
RUN pip show simpleguardhome
# Copy and set up entrypoint script # Copy and set up entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/ COPY docker-entrypoint.sh /usr/local/bin/

View File

@@ -12,9 +12,13 @@ handle_term() {
# Set up signal handlers # Set up signal handlers
trap handle_term SIGTERM SIGINT trap handle_term SIGTERM SIGINT
# Verify package can be imported
echo "Verifying package installation..."
python3 -c "import simpleguardhome" || exit 1
# Start the application # Start the application
echo "Starting SimpleGuardHome server..." echo "Starting SimpleGuardHome server..."
cd /app && PYTHONPATH=/app/src python3 -m simpleguardhome.main & exec python3 -m simpleguardhome.main
# Store child PID # Store child PID
child=$! child=$!

View File

@@ -3,7 +3,8 @@ from setuptools import setup, find_packages
setup( setup(
name="simpleguardhome", name="simpleguardhome",
version="0.1.0", version="0.1.0",
packages=find_packages(), packages=find_packages(where="src"),
package_dir={"": "src"},
include_package_data=True, include_package_data=True,
package_data={ package_data={
"simpleguardhome": ["templates/*"] "simpleguardhome": ["templates/*"]