-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (37 loc) · 1.38 KB
/
Dockerfile
File metadata and controls
47 lines (37 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# ---- Base Image ----
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
ENV HOME=/root
# ---- Fix Slow Mirrors / IPv6 Issues (Pi Friendly) ----
RUN sed -i 's|http://ports.ubuntu.com/ubuntu-ports|mirror://mirrors.ubuntu.com/mirrors.txt|g' /etc/apt/sources.list
# ---- Install Dependencies ----
RUN apt-get -o Acquire::ForceIPv4=true update && \
apt-get install -y --no-install-recommends \
curl \
jq \
cron \
git \
ca-certificates \
openssh-client \
&& rm -rf /var/lib/apt/lists/*
# ---- Script ----
COPY github_backup_script.sh /usr/local/bin/github_backup_script.sh
RUN chmod +x /usr/local/bin/github_backup_script.sh
# ---- Environment ----
COPY .env /tmp/.env
RUN cat /tmp/.env >> /etc/environment && rm /tmp/.env
# ---- Cron Job ----
RUN echo "12 0 * * * /usr/local/bin/github_backup_script.sh >> /var/log/github_backup.log 2>&1" > /etc/cron.d/github-backup && \
chmod 0644 /etc/cron.d/github-backup && \
crontab /etc/cron.d/github-backup
# ---- Logs ----
RUN touch /var/log/github_backup.log
# ---- Git Config ----
COPY .gitconfig /root/.gitconfig
# ---- SSH (Optional – safer via volume, see compose below) ----
RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh
COPY id_ed25519 /root/.ssh/id_ed25519
COPY id_ed25519.pub /root/.ssh/id_ed25519.pub
RUN chmod 600 /root/.ssh/id_ed25519
# ---- Start Cron ----
CMD ["cron", "-f"]