8 Commits

Author SHA1 Message Date
Jonas Forsberg
1076dfaff9 fixed clean target and not showing credentials 2023-04-18 14:05:46 +02:00
Jonas Forsberg
883b06c29c bumped TW version 2023-04-18 13:59:35 +02:00
Jonas Forsberg
24143adf8a fixed clean tag to use variable 2023-04-18 13:56:01 +02:00
Jonas Forsberg
6c13328ee4 added labels to image 2023-04-18 13:53:24 +02:00
25c138ec37 first few OCI lables 2023-04-18 13:29:16 +02:00
9bd451d131 check installed verson of restic in target image 2023-04-18 10:24:57 +02:00
Jonas Forsberg
3a8dbed8db changed to private image repo 2023-04-17 19:43:44 +02:00
Jonas Forsberg
52d867d7ae more verbose tag message 2023-04-17 14:21:03 +02:00
3 changed files with 28 additions and 12 deletions

View File

@@ -1,12 +1,12 @@
ARG VERSION
FROM registry.opensuse.org/opensuse/tumbleweed:${VERSION}
RUN zypper --non-interactive install \
openssh-clients \
restic \
&& zypper clean -a
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

View File

@@ -3,12 +3,18 @@
-include .env
VERSION=20230411
VERSION=20230416
IMAGENAME=restic
REPO=docker.io/bardak
REPO=git.rre.nu/jonas
TITLE=restic with openSSH based on openSUSE Tumpleweed
DESC=Image containing restic & openSSH, based on openSUSE Tumbleweed
BUILD_TIME := $(shell TZ=UTC date --iso-8601=ns)
SHELL := /bin/bash
default: build
require_clean_git:
git update-index -q --ignore-submodules --refresh
git diff-files --quiet --ignore-submodules
@@ -21,18 +27,27 @@ require_clean_git:
exit 1; \
fi
default: 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/${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:
podman image rm docker.io/bardak/restic:$(VERSION)
podman image rm ${REPO}/${IMAGENAME}:$(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}"
$(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
podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:$(VERSION)
podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:latest
@ echo "Pushing images"
@ podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:$(VERSION)
@ podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:latest

View File

@@ -2,6 +2,7 @@
set -aeou pipefail
BASE_IMAGE="registry.opensuse.org/opensuse/tumbleweed"
TARGET_REPO="git.rre.nu/jonas/"
PACKAGE_NAME="restic"
echo "Pulling latest tumbleweed"
@@ -16,7 +17,7 @@ if [[ "$CURRENT_TUMBLEWEED_TAG" == "$LATEST_TUMBLEWEED_TAG" ]]; then
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'")"
CURRENT_VERSION="$(podman run --rm -it ${TARGET_REPO}${PACKAGE_NAME}:latest /usr/bin/bash -c "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"