refactor(docker): update Dockerfile and .dockerignore to streamline package installation and include necessary files

This commit is contained in:
pacnpal
2025-01-29 10:03:22 -05:00
parent 26c2adf1d5
commit c5da870762
2 changed files with 12 additions and 6 deletions

View File

@@ -14,6 +14,9 @@
!requirements.txt !requirements.txt
!docker-entrypoint.sh !docker-entrypoint.sh
!healthcheck.py !healthcheck.py
!setup.py
!pyproject.toml
!MANIFEST.in
# VERIFICATION: Required files that MUST exist: # VERIFICATION: Required files that MUST exist:
# - src/simpleguardhome/__init__.py # - src/simpleguardhome/__init__.py
@@ -23,6 +26,7 @@
# - src/simpleguardhome/templates/index.html # - src/simpleguardhome/templates/index.html
# - src/simpleguardhome/favicon.ico # - src/simpleguardhome/favicon.ico
# - healthcheck.py # - healthcheck.py
# - setup.py
# SAFETY: Never include these files even if allowed above # SAFETY: Never include these files even if allowed above
**/__pycache__/ **/__pycache__/

View File

@@ -13,13 +13,12 @@ RUN apt-get update && \
COPY requirements.txt . COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
# Copy the source code # Copy package files
COPY . . COPY setup.py pyproject.toml MANIFEST.in ./
COPY src ./src
# Clean any previous installations and install the package # Install the package
RUN pip uninstall -y simpleguardhome || true && \ RUN pip install -e . && \
pip install -e . && \
pip show simpleguardhome && \
python3 -c "import simpleguardhome; print('Package found at:', simpleguardhome.__file__)" python3 -c "import simpleguardhome; print('Package found at:', simpleguardhome.__file__)"
# Set up health check # Set up health check
@@ -36,6 +35,9 @@ ENV ADGUARD_HOST="http://localhost" \
# Expose application port # Expose application port
EXPOSE 8000 EXPOSE 8000
# Create rules_backup directory with proper permissions
RUN mkdir -p rules_backup && chmod 777 rules_backup
# Copy and set up entrypoint # Copy and set up entrypoint
COPY docker-entrypoint.sh /usr/local/bin/ COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh RUN chmod +x /usr/local/bin/docker-entrypoint.sh