-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
58 lines (45 loc) · 1.21 KB
/
Dockerfile
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
48
49
50
51
52
53
54
55
56
57
58
ARG borgbackup_version="1.1.11"
# Download the binary
FROM "bitnami/minideb:buster" AS downloader
ARG borgbackup_version
RUN install_packages \
"curl" \
"ca-certificates"
RUN curl --silent --show-error --location \
--output "/usr/bin/borg" \
"https://github.com/borgbackup/borg/releases/download/${borgbackup_version}/borg-linux64"
RUN chmod "+x" "/usr/bin/borg"
# Create the actual container
FROM "bitnami/minideb:buster"
ARG borgbackup_version
# Add the labels for the image
LABEL name="borg-backup"
LABEL summary="Docker Container for the BorgBackup to be used as backup server"
LABEL maintainer="Mira 'Mireiawen' Manninen"
LABEL version="${borgbackup_version}"
# Set up the backup user
RUN useradd \
--create-home \
--user-group \
--shell "/bin/bash" \
--comment "Backup User" \
"borgbackup"
RUN ln --symbolic \
"/home/borgbackup" \
"/backups"
# Install the SSH server
RUN install_packages \
"openssh-server"
RUN mkdir "/run/sshd"
# Install the actual backup
COPY --from=downloader \
"/usr/bin/borg" \
"/usr/bin/borg"
# Define the directory volumes
VOLUME [ "/home/borgbackup" ]
# Expose the SSH port
EXPOSE 22
# Set the entry point
COPY "start.sh" "/start.sh"
ENTRYPOINT [ "/bin/bash" ]
CMD [ "/start.sh" ]