49 lines
1.3 KiB
Docker
49 lines
1.3 KiB
Docker
FROM debian:stable
|
|
|
|
# Install Python3, pip3, and system dependencies
|
|
RUN apt-get update && \
|
|
apt-get install -y \
|
|
cron \
|
|
curl \
|
|
iputils-ping \
|
|
net-tools \
|
|
openssh-client \
|
|
python3 \
|
|
python3-pip \
|
|
python3-venv \
|
|
rsync \
|
|
vim
|
|
RUN groupadd -g 1000 seba && useradd -m -u 1000 -g seba seba
|
|
|
|
# Create app directory
|
|
WORKDIR /app
|
|
|
|
# Create a virtual environment
|
|
RUN python3 -m venv /opt/venv
|
|
|
|
# Activate the virtual environment and install dependencies
|
|
COPY requirements.txt .
|
|
RUN /opt/venv/bin/pip install -r requirements.txt
|
|
|
|
# Copy the Python scripts
|
|
COPY snapit.py container_manager.py backup_scheduler.py ./
|
|
|
|
# Create the upgrade script
|
|
RUN echo '#!/bin/bash\n\
|
|
python3 /app/container_manager.py "$@"' > /usr/local/bin/do-docker-compose-upgrades && \
|
|
chmod +x /usr/local/bin/do-docker-compose-upgrades
|
|
|
|
# Ensure the virtual environment is activated by default
|
|
ENV PATH="/opt/venv/bin:$PATH"
|
|
|
|
# Run both scripts with proper logging
|
|
COPY chown-cron /etc/cron.d/chown-cron
|
|
RUN chmod 0644 /etc/cron.d/chown-cron
|
|
|
|
COPY entrypoint.sh /usr/local/bin/
|
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
|
|
|
ENTRYPOINT ["entrypoint.sh"]
|
|
CMD ["sh", "-c", "python3 ./snapit.py 2>&1 & python3 ./container_manager.py --daemon 2>&1 & wait"]
|
|
|