Rafael Calleja commited on
Commit
c6cc4bd
·
1 Parent(s): 974fa73

Mon Dec 30 12:00:01 AM CET 2024

Browse files
.dockerignore ADDED
@@ -0,0 +1 @@
 
 
1
+ *
Dockerfile CHANGED
@@ -2,13 +2,22 @@
2
  FROM ubuntu:24.04 as base
3
  ENV DEBIAN_FRONTEND=noninteractive
4
  ENV ROOTFS=/tmp/restore
 
 
 
5
 
6
- RUN --mount=type=bind,source=./,target=/var/tmp/restic,rw --security=insecure \
7
- apt update && apt install -yq wget bzip2 make time && \
8
  wget -qO - https://raw.githubusercontent.com/cupcakearmy/autorestic/master/install.sh | bash && \
9
  autorestic --version && \
10
- mkdir -p ${ROOTFS} && \
11
- cd /var/tmp/restic; make restore
 
 
 
 
 
 
 
12
 
13
  WORKDIR ${ROOTFS}
14
  RUN --security=insecure \
 
2
  FROM ubuntu:24.04 as base
3
  ENV DEBIAN_FRONTEND=noninteractive
4
  ENV ROOTFS=/tmp/restore
5
+ ARG SSH_HOST
6
+ ARG SSH_USER
7
+ ARG SSH_PATH=/var/tmp/restic
8
 
9
+ RUN apt update && apt install -yq wget bzip2 make time sshfs fuse3 && \
 
10
  wget -qO - https://raw.githubusercontent.com/cupcakearmy/autorestic/master/install.sh | bash && \
11
  autorestic --version && \
12
+ mkdir -p ${ROOTFS}
13
+
14
+ RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan ${SSH_HOST} >> ~/.ssh/known_hosts
15
+
16
+ WORKDIR /var/tmp/restic
17
+ RUN --security=insecure --mount=type=ssh sshfs -v -o auto_cache,reconnect,transform_symlinks,follow_symlinks ${SSH_USER}@${SSH_HOST}:${SSH_PATH} /var/tmp/restic && \
18
+ cd /var/tmp/restic && \
19
+ ls -la && \
20
+ make restore
21
 
22
  WORKDIR ${ROOTFS}
23
  RUN --security=insecure \
Makefile CHANGED
@@ -17,6 +17,10 @@ RESTORE_DST ?= /tmp/restore
17
  RESTORE_FROM ?= hdd
18
  RESTORE_LOCATION ?= root_backup
19
 
 
 
 
 
20
  default: backup
21
 
22
  backup:
@@ -41,6 +45,7 @@ build:
41
  docker run -it --rm --privileged -e BUILDKITD_FLAGS="--allow-insecure-entitlement security.insecure" \
42
  --volume $(CURRENT_DIR):/tmp/work \
43
  --volume "$${HOME}/.docker:/root/.docker:ro" \
 
44
  --entrypoint buildctl-daemonless.sh \
45
  moby/buildkit:master \
46
  build \
@@ -48,4 +53,7 @@ build:
48
  --local context=/tmp/work \
49
  --local dockerfile=/tmp/work \
50
  --allow security.insecure \
51
- --output type=image,name=$(IMAGE_PROVIDER)/$(IMAGE),push=true
 
 
 
 
17
  RESTORE_FROM ?= hdd
18
  RESTORE_LOCATION ?= root_backup
19
 
20
+ SSH_USER ?= $(shell whoami)
21
+ SSH_HOST ?= $(shell ip addr show | grep -A 2 'eth' | grep inet | awk '{print $2}' | cut -d/ -f1 | head -n 1)
22
+ SSH_AUTH_SOCK ?= $(shell echo ${SSH_AUTH_SOCK})
23
+
24
  default: backup
25
 
26
  backup:
 
45
  docker run -it --rm --privileged -e BUILDKITD_FLAGS="--allow-insecure-entitlement security.insecure" \
46
  --volume $(CURRENT_DIR):/tmp/work \
47
  --volume "$${HOME}/.docker:/root/.docker:ro" \
48
+ --volume $(SSH_AUTH_SOCK):$(SSH_AUTH_SOCK) \
49
  --entrypoint buildctl-daemonless.sh \
50
  moby/buildkit:master \
51
  build \
 
53
  --local context=/tmp/work \
54
  --local dockerfile=/tmp/work \
55
  --allow security.insecure \
56
+ --opt build-arg:SSH_USER=$(SSH_USER) \
57
+ --opt build-arg:SSH_HOST=$(SSH_HOST) \
58
+ --output type=image,name=$(IMAGE_PROVIDER)/$(IMAGE),push=true \
59
+ --ssh default=$(SSH_AUTH_SOCK)
data/5c/5c738705a8345dc35db94cb26ce3ced83fb620f57f9487c8764cb065af02866a ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5c738705a8345dc35db94cb26ce3ced83fb620f57f9487c8764cb065af02866a
3
+ size 842656
data/bc/bcb9dfb8b6520319345ae9988d376207b1ead24d6d2c9975470fb63c4b18ebc9 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bcb9dfb8b6520319345ae9988d376207b1ead24d6d2c9975470fb63c4b18ebc9
3
+ size 18011498
data/bd/bde8c4f20da3786d7feeab205c5e05e490551caf8283f5f7f2f875f1bdd98b3c ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bde8c4f20da3786d7feeab205c5e05e490551caf8283f5f7f2f875f1bdd98b3c
3
+ size 16964221
data/c0/c0602407b6d40f219e34eefb01cdcceea3ac2e5142a1f6b91887b6243825ad35 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c0602407b6d40f219e34eefb01cdcceea3ac2e5142a1f6b91887b6243825ad35
3
+ size 96490
data/c7/c7dae883bff972cc656241e335702884f9fd2a6857c6be55a6d560af9680ec95 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c7dae883bff972cc656241e335702884f9fd2a6857c6be55a6d560af9680ec95
3
+ size 17409979
data/da/da09279a1a3244226d97e6a53fa2760ef3c0aa46bb68790fb45275d2f3c4a906 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da09279a1a3244226d97e6a53fa2760ef3c0aa46bb68790fb45275d2f3c4a906
3
+ size 16874205
index/1587e2375f763e2418af80d2cfb14e2860ddd74c07d25dbdf9f000e35d1e6d04 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1587e2375f763e2418af80d2cfb14e2860ddd74c07d25dbdf9f000e35d1e6d04
3
+ size 58201
snapshots/247bddcb506db7277b3ecdb6fad17f7044f882bf3f11468128257fa28b8efb43 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:247bddcb506db7277b3ecdb6fad17f7044f882bf3f11468128257fa28b8efb43
3
+ size 1615