mirror of
https://github.com/lobaro/restic-backup-docker.git
synced 2026-07-11 10:15:08 +00:00
Reduce layer count in Docker image:
* move the bzip2 and extraction into the scratch image * combine commands and ENV directives to make less layers
This commit is contained in:
+16
-15
@@ -1,26 +1,28 @@
|
|||||||
FROM alpine as certs
|
FROM alpine as certs
|
||||||
RUN apk add --no-cache ca-certificates
|
RUN apk add --no-cache ca-certificates
|
||||||
|
|
||||||
|
|
||||||
FROM busybox:glibc
|
|
||||||
|
|
||||||
COPY --from=certs /etc/ssl/certs /etc/ssl/certs
|
|
||||||
|
|
||||||
# Get restic executable
|
# Get restic executable
|
||||||
ENV RESTIC_VERSION=0.9.5
|
ENV RESTIC_VERSION=0.9.5
|
||||||
ADD https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_amd64.bz2 /
|
ADD https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_amd64.bz2 /
|
||||||
RUN bzip2 -d restic_${RESTIC_VERSION}_linux_amd64.bz2 && mv restic_${RESTIC_VERSION}_linux_amd64 /bin/restic && chmod +x /bin/restic
|
RUN bzip2 -d restic_${RESTIC_VERSION}_linux_amd64.bz2 && mv restic_${RESTIC_VERSION}_linux_amd64 /bin/restic && chmod +x /bin/restic
|
||||||
|
|
||||||
RUN mkdir -p /mnt/restic /var/spool/cron/crontabs /var/log
|
FROM busybox:glibc
|
||||||
|
|
||||||
ENV RESTIC_REPOSITORY=/mnt/restic
|
COPY --from=certs /etc/ssl/certs /etc/ssl/certs
|
||||||
ENV RESTIC_PASSWORD=""
|
COPY --from=certs /bin/restic /bin/restic
|
||||||
ENV RESTIC_TAG=""
|
|
||||||
ENV NFS_TARGET=""
|
RUN \
|
||||||
# By default backup every 6 hours
|
mkdir -p /mnt/restic /var/spool/cron/crontabs /var/log; \
|
||||||
ENV BACKUP_CRON="0 */6 * * *"
|
touch /var/log/cron.log;
|
||||||
ENV RESTIC_FORGET_ARGS=""
|
|
||||||
ENV RESTIC_JOB_ARGS=""
|
ENV \
|
||||||
|
RESTIC_REPOSITORY=/mnt/restic \
|
||||||
|
RESTIC_PASSWORD="" \
|
||||||
|
RESTIC_TAG="" \
|
||||||
|
NFS_TARGET="" \
|
||||||
|
BACKUP_CRON="0 */6 * * *" \
|
||||||
|
RESTIC_FORGET_ARGS="" \
|
||||||
|
RESTIC_JOB_ARGS=""
|
||||||
|
|
||||||
# /data is the dir where you have to put the data to be backed up
|
# /data is the dir where you have to put the data to be backed up
|
||||||
VOLUME /data
|
VOLUME /data
|
||||||
@@ -28,7 +30,6 @@ VOLUME /data
|
|||||||
COPY backup.sh /bin/backup
|
COPY backup.sh /bin/backup
|
||||||
COPY entry.sh /entry.sh
|
COPY entry.sh /entry.sh
|
||||||
|
|
||||||
RUN touch /var/log/cron.log
|
|
||||||
|
|
||||||
WORKDIR "/"
|
WORKDIR "/"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user