Compare commits
19 Commits
v0.15.1-1.
...
main
Author | SHA1 | Date | |
---|---|---|---|
|
ef7a1fece2 | ||
|
6196f612ed | ||
|
c631b253c5 | ||
|
42fea8c6e1 | ||
|
f6c1442dbe | ||
|
56c02abe56 | ||
|
0124701ca5 | ||
|
1076dfaff9 | ||
|
883b06c29c | ||
|
24143adf8a | ||
|
6c13328ee4 | ||
25c138ec37 | |||
9bd451d131 | |||
|
3a8dbed8db | ||
|
52d867d7ae | ||
|
23615777b7 | ||
|
f860eba8a2 | ||
|
a06e4e8f0a | ||
|
58a2f63bbe |
12
Dockerfile
12
Dockerfile
@ -1,10 +1,14 @@
|
|||||||
FROM registry.opensuse.org/opensuse/tumbleweed:latest
|
|
||||||
|
|
||||||
ARG VERSION
|
ARG VERSION
|
||||||
|
FROM registry.opensuse.org/opensuse/tumbleweed:${VERSION}
|
||||||
|
|
||||||
RUN zypper --non-interactive install \
|
RUN zypper --non-interactive install \
|
||||||
openssh-clients \
|
openssh-clients \
|
||||||
restic-${VERSION} \
|
restic \
|
||||||
&& zypper clean -a
|
&& zypper clean -a
|
||||||
ADD entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
||||||
|
ENV TZ="Europe/Stockholm"
|
||||||
|
|
||||||
|
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||||
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||||
|
CMD ["start"]
|
||||||
|
48
Makefile
48
Makefile
@ -1,21 +1,51 @@
|
|||||||
.PHONY: default build clean
|
.PHONY: default build clean release require_clean_git
|
||||||
|
|
||||||
|
|
||||||
-include .env
|
-include .env
|
||||||
|
|
||||||
VERSION=0.15.1-1.2
|
VERSION=20230926
|
||||||
|
IMAGENAME=restic
|
||||||
|
REPO=git.rre.nu/jonas
|
||||||
|
TITLE=restic with openSSH based on openSUSE Tumpleweed
|
||||||
|
DESC=Image containing restic & openSSH, based on openSUSE Tumbleweed
|
||||||
|
|
||||||
SHELL := /bin/bash
|
SHELL := /bin/bash
|
||||||
|
|
||||||
guard:
|
|
||||||
@ if [ -z "$(git status --porcelain)" ]; then echo "git repo not clean"; exit 1; fi
|
|
||||||
|
|
||||||
default: build
|
default: build
|
||||||
|
|
||||||
|
require_clean_git:
|
||||||
|
git update-index -q --ignore-submodules --refresh
|
||||||
|
git diff-files --quiet --ignore-submodules
|
||||||
|
git diff-index --cached --quiet --ignore-submodules HEAD --
|
||||||
|
@status=$$(git status --porcelain); \
|
||||||
|
if test "x$${status}" = x; then \
|
||||||
|
echo "No untracked files detected"; \
|
||||||
|
else \
|
||||||
|
echo "Untracked files detected" >&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
build:
|
build:
|
||||||
podman build --build-arg VERSION=$(VERSION) --tag docker.io/bardak/restic:$(VERSION) .
|
podman build \
|
||||||
|
--build-arg VERSION="$(VERSION)" \
|
||||||
|
--label org.opencontainers.image.source="https://${REPO}/${IMAGENAME}/src/tag/v${VERSION}" \
|
||||||
|
--label org.opencontainers.image.title="${TITLE}" \
|
||||||
|
--label org.opencontainers.image.description="${DESC}" \
|
||||||
|
--label org.opencontainers.image.created="$(shell TZ=UTC date --iso-8601=ns)" \
|
||||||
|
--label org.opencontainers.image.url="https://${REPO}/-/packages/container/${IMAGENAME}/${VERSION}" \
|
||||||
|
--label org.opencontainers.image.version="${VERSION}" \
|
||||||
|
--label org.opencontainers.image.vendor="Jonas Forsberg" \
|
||||||
|
--tag ${REPO}/${IMAGENAME}:$(VERSION) \
|
||||||
|
.
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
podman image rm docker.io/bardak/restic:$(VERSION)
|
podman image rm ${REPO}/${IMAGENAME}:$(VERSION)
|
||||||
|
|
||||||
push: guard build
|
release: require_clean_git build
|
||||||
podman push --creds $(USERNAME):$(PASSWORD) docker.io/bardak/restic:$(VERSION)
|
$(eval TMP_MESSAGE := $(shell podman run --rm -it ${REPO}/${IMAGENAME}:$(VERSION) /usr/bin/restic --version))
|
||||||
|
git tag -a v$(VERSION) -m "restic version: ${TMP_MESSAGE}"
|
||||||
|
git push origin v$(VERSION)
|
||||||
|
podman tag ${REPO}/${IMAGENAME}:$(VERSION) ${REPO}/${IMAGENAME}:latest
|
||||||
|
@ echo "Pushing images"
|
||||||
|
@ podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:$(VERSION)
|
||||||
|
@ podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:latest
|
||||||
|
39
autobuild.sh
Executable file
39
autobuild.sh
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -aeou pipefail
|
||||||
|
|
||||||
|
BASE_IMAGE="registry.opensuse.org/opensuse/tumbleweed"
|
||||||
|
TARGET_REPO="git.rre.nu/jonas/"
|
||||||
|
PACKAGE_NAME="restic"
|
||||||
|
|
||||||
|
git pull
|
||||||
|
|
||||||
|
echo "Pulling latest tumbleweed"
|
||||||
|
podman pull "${BASE_IMAGE}:latest"
|
||||||
|
|
||||||
|
CURRENT_TUMBLEWEED_TAG="$(sed -n 's/.*VERSION=\([0-9]\)/\1/p' Makefile)"
|
||||||
|
LATEST_TUMBLEWEED_TAG="$(podman image inspect --format "{{.Labels}}" registry.opensuse.org/opensuse/tumbleweed:latest | sed -n 's/.*org\.opencontainers\.image\.version:\([0-9]\{8\}\).*/\1/p')"
|
||||||
|
|
||||||
|
if [[ "$CURRENT_TUMBLEWEED_TAG" == "$LATEST_TUMBLEWEED_TAG" ]]; then
|
||||||
|
echo "Already running latest tumbleweed version"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "New tumbleweed image exists"
|
||||||
|
if [[ "x" == "x$(podman run --rm -it ${TARGET_REPO}${PACKAGE_NAME}:latest /usr/bin/bash -c "zypper list-updates | grep $PACKAGE_NAME")" ]]; then
|
||||||
|
echo "No updates for $PACKAGE_NAME"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
LATEST_VERSION="$(podman run --rm -it ${BASE_IMAGE}:latest /usr/bin/bash -c "zypper ref > /dev/null && zypper info $PACKAGE_NAME | sed -n 's/.*Version : \(.*\)$/\1/p'")"
|
||||||
|
|
||||||
|
echo "updates found : $LATEST_VERSION"
|
||||||
|
|
||||||
|
#Updateing Makefile with latest image tag
|
||||||
|
sed -i 's/VERSION='"$CURRENT_TUMBLEWEED_TAG"'/VERSION='"$LATEST_TUMBLEWEED_TAG"'/' Makefile
|
||||||
|
git add Makefile
|
||||||
|
git commit -m "Updated tumpleweed image to $LATEST_TUMBLEWEED_TAG, $PACKAGE_NAME to $LATEST_VERSION"
|
||||||
|
git push
|
||||||
|
|
||||||
|
echo "build and push new image"
|
||||||
|
|
||||||
|
make release
|
||||||
|
|
10
entrypoint.sh
Executable file → Normal file
10
entrypoint.sh
Executable file → Normal file
@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
#
|
|
||||||
|
|
||||||
if [[ "$1" == "bash" ]]; then
|
|
||||||
exec /usr/bin/bash
|
if [[ "$1" == "start" ]]; then
|
||||||
|
/usr/bin/restic "$@"
|
||||||
else
|
else
|
||||||
restic "$@"
|
exec "$@"
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user