From c5da870762be4e6df23948507d767e4fb9d7bfb4 Mon Sep 17 00:00:00 2001 From: pacnpal <183241239+pacnpal@users.noreply.github.com> Date: Wed, 29 Jan 2025 10:03:22 -0500 Subject: [PATCH] refactor(docker): update Dockerfile and .dockerignore to streamline package installation and include necessary files --- .dockerignore | 4 ++++ Dockerfile | 14 ++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.dockerignore b/.dockerignore index c0af9be..5d039cd 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,6 +14,9 @@ !requirements.txt !docker-entrypoint.sh !healthcheck.py +!setup.py +!pyproject.toml +!MANIFEST.in # VERIFICATION: Required files that MUST exist: # - src/simpleguardhome/__init__.py @@ -23,6 +26,7 @@ # - src/simpleguardhome/templates/index.html # - src/simpleguardhome/favicon.ico # - healthcheck.py +# - setup.py # SAFETY: Never include these files even if allowed above **/__pycache__/ diff --git a/Dockerfile b/Dockerfile index b5eb554..e282c58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,13 +13,12 @@ RUN apt-get update && \ COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt -# Copy the source code -COPY . . +# Copy package files +COPY setup.py pyproject.toml MANIFEST.in ./ +COPY src ./src -# Clean any previous installations and install the package -RUN pip uninstall -y simpleguardhome || true && \ - pip install -e . && \ - pip show simpleguardhome && \ +# Install the package +RUN pip install -e . && \ python3 -c "import simpleguardhome; print('Package found at:', simpleguardhome.__file__)" # Set up health check @@ -36,6 +35,9 @@ ENV ADGUARD_HOST="http://localhost" \ # Expose application port EXPOSE 8000 +# Create rules_backup directory with proper permissions +RUN mkdir -p rules_backup && chmod 777 rules_backup + # Copy and set up entrypoint COPY docker-entrypoint.sh /usr/local/bin/ RUN chmod +x /usr/local/bin/docker-entrypoint.sh