forked from cupcakearmy/autorestic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
34 lines (29 loc) · 1.16 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
FROM golang:1.18-alpine as builder
WORKDIR /app
COPY go.* ./
RUN go mod download
COPY . ./
RUN go build
FROM alpine
ARG TARGETARCH
RUN apk add --no-cache restic rclone bash openssh docker-cli
RUN if [ "$TARGETARCH" = "amd64" ]; then \
mkdir -p ~/.docker/cli-plugins && \
wget https://github.com/docker/compose/releases/latest/download/docker-compose-linux-x86_64 -O ~/.docker/cli-plugins/docker-compose && \
chmod +x ~/.docker/cli-plugins/docker-compose && \
docker compose version; \
else \
mkdir -p ~/.docker/cli-plugins && \
wget https://github.com/docker/compose/releases/latest/download/docker-compose-linux-aarch64 -O ~/.docker/cli-plugins/docker-compose && \
chmod +x ~/.docker/cli-plugins/docker-compose && \
docker compose version; \
fi
COPY --from=builder /app/autorestic /usr/bin/autorestic
COPY entrypoint.sh /entrypoint.sh
COPY crond.sh /crond.sh
RUN chmod +x /entrypoint.sh /crond.sh
# show autorestic cron logs in docker
RUN ln -sf /proc/1/fd/1 /var/log/autorestic-cron.log
# run autorestic-cron every minute
RUN echo -e "*/1 * * * * bash /crond.sh" >> /etc/crontabs/root
CMD [ "/entrypoint.sh" ]