Compare commits
No commits in common. "23615777b75527af7f31b5370e40eb4531566120" and "04ec1f51d8a8668d89db48790784f28f141f1459" have entirely different histories.
23615777b7
...
04ec1f51d8
11
Dockerfile
11
Dockerfile
@ -1,13 +1,10 @@
|
||||
ARG VERSION
|
||||
FROM registry.opensuse.org/opensuse/tumbleweed:${VERSION}
|
||||
FROM registry.opensuse.org/opensuse/tumbleweed:latest
|
||||
|
||||
ARG VERSION
|
||||
|
||||
RUN zypper --non-interactive install \
|
||||
openssh-clients \
|
||||
restic \
|
||||
restic-${VERSION} \
|
||||
&& zypper clean -a
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
ADD entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
CMD ["start"]
|
||||
|
29
Makefile
29
Makefile
@ -1,25 +1,13 @@
|
||||
.PHONY: default build clean release require_clean_git
|
||||
|
||||
.PHONY: default build clean
|
||||
|
||||
-include .env
|
||||
|
||||
VERSION=20230411
|
||||
IMAGENAME=restic
|
||||
REPO=docker.io/bardak
|
||||
VERSION=0.15.1-1.2
|
||||
|
||||
SHELL := /bin/bash
|
||||
|
||||
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
|
||||
guard:
|
||||
@ if [ -z "$(git status --porcelain)" ]; then echo "git repo not clean"; exit 1; fi
|
||||
|
||||
default: build
|
||||
|
||||
@ -29,10 +17,5 @@ build:
|
||||
clean:
|
||||
podman image rm docker.io/bardak/restic:$(VERSION)
|
||||
|
||||
release: require_clean_git build
|
||||
$(eval TMP_MESSAGE := $(shell podman run --rm -it ${REPO}/${IMAGENAME}:$(VERSION) /usr/bin/restic --version))
|
||||
git tag -a v$(VERSION) -m "${TMP_MESSAGE}"
|
||||
git push origin v$(VERSION)
|
||||
podman tag ${REPO}/${IMAGENAME}:$(VERSION) ${REPO}/${IMAGENAME}:latest
|
||||
podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:$(VERSION)
|
||||
podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:latest
|
||||
push: guard build
|
||||
podman push --creds $(USERNAME):$(PASSWORD) docker.io/bardak/restic:$(VERSION)
|
||||
|
38
autobuild.sh
38
autobuild.sh
@ -1,38 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -aeou pipefail
|
||||
|
||||
BASE_IMAGE="registry.opensuse.org/opensuse/tumbleweed"
|
||||
PACKAGE_NAME="restic"
|
||||
|
||||
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"
|
||||
CURRENT_VERSION="$(podman run --rm -it ${BASE_IMAGE}:${CURRENT_TUMBLEWEED_TAG} /usr/bin/bash -c "zypper ref > /dev/null && zypper info $PACKAGE_NAME | sed -n 's/.*Version : \(.*\)$/\1/p'")"
|
||||
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 "current : $CURRENT_VERSION"
|
||||
echo "latest : $LATEST_VERSION"
|
||||
|
||||
if [[ "$CURRENT_VERSION" == "$LATEST_VERSION" ]]; then
|
||||
echo "No new $PACKAGE_NAME version detected"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#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
Normal file → Executable file
10
entrypoint.sh
Normal file → Executable file
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
#
|
||||
|
||||
|
||||
if [[ "$1" == "start" ]]; then
|
||||
/usr/bin/restic "$@"
|
||||
if [[ "$1" == "bash" ]]; then
|
||||
exec /usr/bin/bash
|
||||
else
|
||||
exec "$@"
|
||||
restic "$@"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user