Redesign health service + create backup service
This commit is contained in:
30
backup-service/Dockerfile
Normal file
30
backup-service/Dockerfile
Normal file
@@ -0,0 +1,30 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install PostgreSQL client (for pg_dump and psql) and cron
|
||||
RUN apt-get update && apt-get install -y \
|
||||
postgresql-client \
|
||||
cron \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Python dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy application
|
||||
COPY . .
|
||||
|
||||
# Make scripts executable
|
||||
RUN chmod +x backup.py restore.py
|
||||
|
||||
# Setup cron
|
||||
COPY crontab /etc/cron.d/backup-cron
|
||||
RUN chmod 0644 /etc/cron.d/backup-cron
|
||||
RUN crontab /etc/cron.d/backup-cron
|
||||
|
||||
# Create log file
|
||||
RUN touch /var/log/cron.log
|
||||
|
||||
# Start cron in foreground and tail logs
|
||||
CMD ["sh", "-c", "printenv > /etc/environment && cron && tail -f /var/log/cron.log"]
|
||||
Reference in New Issue
Block a user