diff options
| author | diogo464 <[email protected]> | 2025-07-17 18:33:44 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2025-07-17 18:33:44 +0100 |
| commit | c670837c11cf493255566642e553d9ecf2e17647 (patch) | |
| tree | a1b748a4751203c7803a4f345e5bc5bc9025e71c | |
| parent | bd84f2d3409fb5d89ce2c9649f8a7766bc0b1a03 (diff) | |
added container image and build script
| -rw-r--r-- | Containerfile | 8 | ||||
| -rwxr-xr-x | build.sh | 23 |
2 files changed, 31 insertions, 0 deletions
diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..326532f --- /dev/null +++ b/Containerfile | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | FROM alpine:latest | ||
| 2 | RUN apk add --no-cache zfs zfs-lts | ||
| 3 | |||
| 4 | COPY target/x86_64-unknown-linux-musl/release/zsnap /usr/local/bin/zsnap | ||
| 5 | |||
| 6 | ENV ZSNAP_CONFIG=/etc/zsnap.toml | ||
| 7 | |||
| 8 | CMD ["zsnap", "run"] | ||
diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..37d0f91 --- /dev/null +++ b/build.sh | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | set -euo pipefail | ||
| 3 | |||
| 4 | # Build zsnap for musl target | ||
| 5 | echo "Building zsnap for x86_64-unknown-linux-musl..." | ||
| 6 | |||
| 7 | # Install musl target if not already installed | ||
| 8 | rustup target add x86_64-unknown-linux-musl | ||
| 9 | |||
| 10 | # Build the binary | ||
| 11 | cargo build --release --target x86_64-unknown-linux-musl --target-dir target/ | ||
| 12 | |||
| 13 | echo "Build completed successfully!" | ||
| 14 | echo "Binary location: target/x86_64-unknown-linux-musl/release/zsnap" | ||
| 15 | |||
| 16 | # Build and push container image | ||
| 17 | echo "Building container image..." | ||
| 18 | podman build -t cr.d464.sh/zsnap:latest . | ||
| 19 | |||
| 20 | echo "Pushing container image..." | ||
| 21 | podman push cr.d464.sh/zsnap:latest | ||
| 22 | |||
| 23 | echo "Container image pushed successfully!" \ No newline at end of file | ||
