mirror of
https://github.com/pacnpal/simpleguardhome.git
synced 2025-12-20 04:21:13 -05:00
47 lines
1.2 KiB
Docker
47 lines
1.2 KiB
Docker
# Use official Python base image
|
|
FROM python:3.11-slim
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends gcc && \
|
|
apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy requirements first for better caching
|
|
COPY requirements.txt .
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy the source code
|
|
COPY . .
|
|
|
|
# Clean any previous installations and install the package
|
|
RUN pip uninstall -y simpleguardhome || true && \
|
|
pip install -e . && \
|
|
pip show simpleguardhome && \
|
|
python3 -c "import simpleguardhome; print('Package found at:', simpleguardhome.__file__)"
|
|
|
|
# Copy and set up entrypoint script
|
|
COPY docker-entrypoint.sh /usr/local/bin/
|
|
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
|
|
|
# Create rules backup directory with proper permissions
|
|
RUN mkdir -p /app/rules_backup && \
|
|
chmod 777 /app/rules_backup
|
|
|
|
# Default environment variables
|
|
ENV ADGUARD_HOST="http://localhost" \
|
|
ADGUARD_PORT=3000
|
|
|
|
# Expose the application port
|
|
EXPOSE 8000
|
|
|
|
# Volume for persisting rules backups
|
|
VOLUME ["/app/rules_backup"]
|
|
|
|
# Set entrypoint
|
|
ENTRYPOINT ["docker-entrypoint.sh"] |