50 lines
1.0 KiB
Docker
50 lines
1.0 KiB
Docker
# Use Ubuntu 20.04 as the base image
|
|
FROM ubuntu:20.04
|
|
|
|
# Set environment variables to avoid interactive prompts
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
ENV TZ=America/Chicago
|
|
|
|
# Install dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
sqlite3 \
|
|
awscli \
|
|
cron \
|
|
tar \
|
|
gzip \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
ARG CACHE_BUST=1
|
|
|
|
# Create necessary directories
|
|
RUN mkdir -p /jobs/data/sqlite
|
|
RUN mkdir -p /var/tmp
|
|
|
|
COPY backup_sqlite.sh /usr/local/bin/backup_script.sh
|
|
|
|
# Make the script executable
|
|
RUN chmod +x /usr/local/bin/backup_script.sh
|
|
|
|
# Create the cron log file
|
|
RUN touch /var/log/cron.log
|
|
|
|
COPY backup_cron /etc/cron.d/backup_cron
|
|
|
|
# Set permissions for the cron job file
|
|
RUN chmod 0644 /etc/cron.d/backup_cron
|
|
|
|
# Apply the cron job
|
|
RUN crontab /etc/cron.d/backup_cron
|
|
|
|
# Expose the cron log file as a volume
|
|
VOLUME /var/log
|
|
|
|
# Copy the entrypoint script
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
|
|
# Make the entrypoint script executable
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
# Use the entrypoint script to start the container
|
|
CMD ["/entrypoint.sh"]
|