22 lines
530 B
Docker
22 lines
530 B
Docker
FROM alpine:latest
|
|
|
|
# Install necessary packages
|
|
RUN apk add --no-cache bash docker-cli curl
|
|
|
|
# Copy the backup script into the container
|
|
COPY backup.sh /usr/local/bin/backup.sh
|
|
|
|
# Make the script executable
|
|
RUN chmod +x /usr/local/bin/backup.sh
|
|
|
|
# Install cron
|
|
RUN apk add --no-cache openrc
|
|
|
|
# Accept CRON_SCHEDULE as a build argument
|
|
ARG CRON_SCHEDULE
|
|
|
|
# Add the cron job
|
|
RUN echo "$CRON_SCHEDULE /usr/local/bin/backup.sh >> /proc/1/fd/1 2>> /proc/1/fd/2" > /etc/crontabs/root
|
|
|
|
# Start cron in the foreground
|
|
CMD ["crond", "-f"] |