Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ef7a1fece2 | ||
|
6196f612ed | ||
|
c631b253c5 | ||
|
42fea8c6e1 | ||
|
f6c1442dbe | ||
|
56c02abe56 | ||
|
0124701ca5 | ||
|
1076dfaff9 | ||
|
883b06c29c | ||
|
24143adf8a | ||
|
6c13328ee4 |
@ -1,19 +1,12 @@
|
|||||||
ARG VERSION
|
ARG VERSION
|
||||||
ARG BUILD_TIME
|
|
||||||
FROM registry.opensuse.org/opensuse/tumbleweed:${VERSION}
|
FROM registry.opensuse.org/opensuse/tumbleweed:${VERSION}
|
||||||
|
|
||||||
LABEL org.opencontainers.image.description=Image containing restic & openSSH, based on openSUSE Tumbleweed
|
|
||||||
LABEL org.opencontainers.image.source=https://git.rre.nu/jonas/restic/src/tag/${VERSION}
|
|
||||||
LABEL org.opencontainers.image.title=restic with openSSH based on openSUSE Tumpleweed
|
|
||||||
LABEL org.opencontainers.image.url=https://git.rre.nu/jonas/-/packages/container/restic/${VERSION}
|
|
||||||
LABEL org.opencontainers.image.created=${BUILD_TIME}
|
|
||||||
|
|
||||||
|
|
||||||
RUN zypper --non-interactive install \
|
RUN zypper --non-interactive install \
|
||||||
openssh-clients \
|
openssh-clients \
|
||||||
restic \
|
restic \
|
||||||
&& zypper clean -a
|
&& zypper clean -a
|
||||||
|
|
||||||
|
ENV TZ="Europe/Stockholm"
|
||||||
|
|
||||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||||
|
29
Makefile
29
Makefile
@ -3,14 +3,16 @@
|
|||||||
|
|
||||||
-include .env
|
-include .env
|
||||||
|
|
||||||
VERSION=20230411
|
VERSION=20230926
|
||||||
IMAGENAME=restic
|
IMAGENAME=restic
|
||||||
REPO=git.rre.nu/jonas
|
REPO=git.rre.nu/jonas
|
||||||
|
TITLE=restic with openSSH based on openSUSE Tumpleweed
|
||||||
BUILD_TIME := $(shell TZ=UTC date --iso-8601=ns)
|
DESC=Image containing restic & openSSH, based on openSUSE Tumbleweed
|
||||||
|
|
||||||
SHELL := /bin/bash
|
SHELL := /bin/bash
|
||||||
|
|
||||||
|
default: build
|
||||||
|
|
||||||
require_clean_git:
|
require_clean_git:
|
||||||
git update-index -q --ignore-submodules --refresh
|
git update-index -q --ignore-submodules --refresh
|
||||||
git diff-files --quiet --ignore-submodules
|
git diff-files --quiet --ignore-submodules
|
||||||
@ -23,22 +25,27 @@ require_clean_git:
|
|||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
default: build
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
podman build \
|
podman build \
|
||||||
--build-arg VERSION=$(VERSION) \
|
--build-arg VERSION="$(VERSION)" \
|
||||||
--build-arg BUILD_TIME=${BUILD_TIME} \
|
--label org.opencontainers.image.source="https://${REPO}/${IMAGENAME}/src/tag/v${VERSION}" \
|
||||||
--tag docker.io/bardak/restic:$(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)
|
||||||
|
|
||||||
release: require_clean_git build
|
release: require_clean_git build
|
||||||
$(eval TMP_MESSAGE := $(shell podman run --rm -it ${REPO}/${IMAGENAME}:$(VERSION) /usr/bin/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 tag -a v$(VERSION) -m "restic version: ${TMP_MESSAGE}"
|
||||||
git push origin v$(VERSION)
|
git push origin v$(VERSION)
|
||||||
podman tag ${REPO}/${IMAGENAME}:$(VERSION) ${REPO}/${IMAGENAME}:latest
|
podman tag ${REPO}/${IMAGENAME}:$(VERSION) ${REPO}/${IMAGENAME}:latest
|
||||||
podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:$(VERSION)
|
@ echo "Pushing images"
|
||||||
podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:latest
|
@ podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:$(VERSION)
|
||||||
|
@ podman push --creds $(USERNAME):$(PASSWORD) ${REPO}/${IMAGENAME}:latest
|
||||||
|
16
autobuild.sh
16
autobuild.sh
@ -5,6 +5,8 @@ BASE_IMAGE="registry.opensuse.org/opensuse/tumbleweed"
|
|||||||
TARGET_REPO="git.rre.nu/jonas/"
|
TARGET_REPO="git.rre.nu/jonas/"
|
||||||
PACKAGE_NAME="restic"
|
PACKAGE_NAME="restic"
|
||||||
|
|
||||||
|
git pull
|
||||||
|
|
||||||
echo "Pulling latest tumbleweed"
|
echo "Pulling latest tumbleweed"
|
||||||
podman pull "${BASE_IMAGE}:latest"
|
podman pull "${BASE_IMAGE}:latest"
|
||||||
|
|
||||||
@ -17,16 +19,13 @@ if [[ "$CURRENT_TUMBLEWEED_TAG" == "$LATEST_TUMBLEWEED_TAG" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "New tumbleweed image exists"
|
echo "New tumbleweed image exists"
|
||||||
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'")"
|
if [[ "x" == "x$(podman run --rm -it ${TARGET_REPO}${PACKAGE_NAME}:latest /usr/bin/bash -c "zypper list-updates | grep $PACKAGE_NAME")" ]]; then
|
||||||
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 "No updates for $PACKAGE_NAME"
|
||||||
|
|
||||||
echo "current : $CURRENT_VERSION"
|
|
||||||
echo "latest : $LATEST_VERSION"
|
|
||||||
|
|
||||||
if [[ "$CURRENT_VERSION" == "$LATEST_VERSION" ]]; then
|
|
||||||
echo "No new $PACKAGE_NAME version detected"
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
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
|
#Updateing Makefile with latest image tag
|
||||||
sed -i 's/VERSION='"$CURRENT_TUMBLEWEED_TAG"'/VERSION='"$LATEST_TUMBLEWEED_TAG"'/' Makefile
|
sed -i 's/VERSION='"$CURRENT_TUMBLEWEED_TAG"'/VERSION='"$LATEST_TUMBLEWEED_TAG"'/' Makefile
|
||||||
@ -37,3 +36,4 @@ git push
|
|||||||
echo "build and push new image"
|
echo "build and push new image"
|
||||||
|
|
||||||
make release
|
make release
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user