diff --git a/.gitea/workflows/build-and-push.yaml b/.gitea/workflows/build-and-push.yaml index 47073d6..2bf286d 100644 --- a/.gitea/workflows/build-and-push.yaml +++ b/.gitea/workflows/build-and-push.yaml @@ -371,11 +371,27 @@ jobs: run: | git config --local user.email "action@pi-farm.de" git config --local user.name "Gitea Action" + + # Sicherstellen, dass wir etwas zum Committen haben git add VERSION.history README.md docker-compose.yml + + # Nur committen, wenn es ร„nderungen gibt git diff --quiet && git diff --staged --quiet || git commit -m "${{ env.FINAL_MSG }} [skip ci]" - git tag -f "v${{ steps.prep.outputs.docker_tag }}" - git push origin main - git push -f origin "v${{ steps.prep.outputs.docker_tag }}" + + # Das Tag exakt so setzen, wie es in prep definiert wurde (ohne extra 'v') + TARGET_TAG="${{ steps.prep.outputs.docker_tag }}" + git tag -f "$TARGET_TAG" + + if [[ "${{ gitea.ref }}" == refs/tags/* ]]; then + echo "๐Ÿท๏ธ Build aus Tag getriggert: $TARGET_TAG" + # Wir pushen das Tag (force), um die Doku-Updates einzuschlieรŸen + git push -f origin "$TARGET_TAG" + else + echo "๐ŸŒฟ Build aus Branch/Schedule getriggert: ${{ gitea.ref_name }}" + # In den Branch pushen (HEAD:branch_name) und das Tag setzen + git push origin HEAD:${{ gitea.ref_name }} + git push -f origin "$TARGET_TAG" + fi - name: Cleanup Temporary Tags on Docker Hub if: steps.check_changes.outputs.should_build == 'true' && contains(steps.prep.outputs.push_targets, 'dockerhub') diff --git a/Dockerfile b/Dockerfile index 07bb5b9..6004abe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,34 @@ -# Example Dockerfile for amd64 -ARG BASE_IMAGE=alpine:latest +ARG BUILD_BASE_IMAGE +ARG BUILD_RUNTIME_IMAGE +FROM ${BUILD_BASE_IMAGE} AS builder -FROM ${BASE_IMAGE} +ARG BUILD_TAG +ARG BUILD_MAINTAINER +ARG BUILD_TZ +ARG BUILD_APP_NAME +ARG BUILD_APP_USER +ARG BUILD_APP_GIT +ARG ENV_TZ -ARG MAINTAINER -ARG TZ -ARG APP_NAME -ARG APP_USER +LABEL maintainer="${BUILD_MAINTAINER}" +LABEL org.opencontainers.image.title="${BUILD_APP_NAME}" -LABEL maintainer="${MAINTAINER}" -LABEL org.opencontainers.image.title="${APP_NAME}" +ENV TZ=${ENV_TZ} -ENV TZ=${TZ} -ENV USER=${APP_USER} +RUN apt update && \ + apt install -y git build-essential cmake curl ninja-build ccache git libcurl4-openssl-dev libevent-dev ruby libtbb-dev && \ + git clone ${BUILD_APP_GIT} /app/hibp && \ + cd /app/hibp && \ + git submodule update --init --recursive && \ + cd ext/restinio && \ + gem install Mxx_ru && \ + mxxruexternals && \ + cd ../.. && \ + ./build.sh -c gcc -b release -RUN apk add --no-cache tzdata ca-certificates +FROM ${BUILD_RUNTIME_IMAGE} -WORKDIR /app -COPY ./config /app/config -COPY ./data /app/data - -RUN adduser -D ${APP_USER} && chown -R ${APP_USER}:${APP_USER} /app - -USER ${APP_USER} - -CMD ["sh"] \ No newline at end of file +COPY --from=builder /app/hibp/build/gcc/release/* /usr/local/bin/ +COPY root/ / +VOLUME /data +EXPOSE 8082 \ No newline at end of file diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index f02657b..6004abe 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,27 +1,34 @@ -# Example Dockerfile for arm64 -ARG BASE_IMAGE=alpine:latest +ARG BUILD_BASE_IMAGE +ARG BUILD_RUNTIME_IMAGE +FROM ${BUILD_BASE_IMAGE} AS builder -FROM ${BASE_IMAGE} +ARG BUILD_TAG +ARG BUILD_MAINTAINER +ARG BUILD_TZ +ARG BUILD_APP_NAME +ARG BUILD_APP_USER +ARG BUILD_APP_GIT +ARG ENV_TZ -ARG MAINTAINER -ARG TZ -ARG APP_NAME -ARG APP_USER +LABEL maintainer="${BUILD_MAINTAINER}" +LABEL org.opencontainers.image.title="${BUILD_APP_NAME}" -LABEL maintainer="${MAINTAINER}" -LABEL org.opencontainers.image.title="${APP_NAME}" +ENV TZ=${ENV_TZ} -ENV TZ=${TZ} -ENV USER=${APP_USER} +RUN apt update && \ + apt install -y git build-essential cmake curl ninja-build ccache git libcurl4-openssl-dev libevent-dev ruby libtbb-dev && \ + git clone ${BUILD_APP_GIT} /app/hibp && \ + cd /app/hibp && \ + git submodule update --init --recursive && \ + cd ext/restinio && \ + gem install Mxx_ru && \ + mxxruexternals && \ + cd ../.. && \ + ./build.sh -c gcc -b release -RUN apk add --no-cache tzdata ca-certificates +FROM ${BUILD_RUNTIME_IMAGE} -WORKDIR /app -COPY ./config /app/config -COPY ./data /app/data - -RUN adduser -D ${APP_USER} && chown -R ${APP_USER}:${APP_USER} /app - -USER ${APP_USER} - -CMD ["sh"] \ No newline at end of file +COPY --from=builder /app/hibp/build/gcc/release/* /usr/local/bin/ +COPY root/ / +VOLUME /data +EXPOSE 8082 \ No newline at end of file diff --git a/README.md b/README.md index f452a48..7b5593e 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,55 @@ -# Projekt: {{.RepoName}} [![Build Status](https://git.pi-farm.de/{{.Owner.Name}}/{{.RepoName}}/actions/workflows/build-and-push.yaml/badge.svg)](https://git.pi-farm.de/{{.Owner.Name}}/{{.RepoName}}/actions) +# hibp-docker +Docker implementation of https://github.com/oschonrock/hibp.git. + +[![Build Status](https://git.pi-farm.de/pi-farm/hibp-docker/actions/workflows/build-and-push.yaml/badge.svg)](https://git.pi-farm.de/pi-farm/hibp-docker/actions) +[![Gitea Repo](https://img.shields.io/badge/gitea-repository-blue?logo=gitea&logoColor=white)](__REPO_URL__) This repository is built and pushed automatically. -### ๐Ÿ—๏ธ Platform Support -| Architecture | Status | Base-Image | -| :--- | :--- | :--- | -| **x86_64** (amd64) | โœ… Active | `__BASE_IMAGE__` | -| **aarch64** (arm64) | __ARM_STATUS__ | `__BASE_IMAGE__` | -### ๐Ÿš€ Docker Pull Command + +### ๐Ÿ—๏ธ Platform Support +| Architecture | Status | Base Image | Build Date | +| :--- | :--- | :--- | :--- | +| x86_64 (amd64) | โœ… Active | git.pi-farm.de/pi-farm/docker-baseimage-debian:trixie-slim | 25.03.2026 10:29 | +| aarch64 (arm64) | โœ… Active | git.pi-farm.de/pi-farm/docker-baseimage-debian:trixie-slim | 25.03.2026 10:29 | + +### ๐Ÿš€ Docker Pull ```bash -docker pull git.pi-farm.de/{{.Owner.Name}}/{{.RepoName}}:latest +docker pull git.pi-farm.de/pi-farm/hibp-docker:0.6.2 ``` ---- -*Last updated on: __DATE__* +### ๐Ÿš€ Docker Compose +```yaml +services: + hibp-docker: + image: git.pi-farm.de/pi-farm/hibp-docker:0.6.2 + container_name: hibp-docker + restart: unless-stopped + ports: + - 8082:8082 + environment: + - TZ=Europe/Berlin + - PUID=1000 + - PGID=1000 + volumes: + - /data +``` +### ๐Ÿš€ Docker Run +```bash +docker run -d \ + --name hibp-docker \ + --restart unless-stopped \ + -e TZ=Europe/Berlin \ + -e PUID=1000 \ + -e PGID=1000 \ + -v /data \ + -p 8082:8082 \ + git.pi-farm.de/pi-farm/hibp-docker:0.6.2 +``` + +*Last updated on: 25.03.2026 10:29* + +### ๐Ÿ“œ Version History +| Version | Date | Status | +| :--- | :--- | :--- | +| **0.6.2** | 25.03.2026 10:29 | โœ… | diff --git a/VERSION.history b/VERSION.history index e69de29..8799fa0 100644 --- a/VERSION.history +++ b/VERSION.history @@ -0,0 +1 @@ +| **0.6.2** | 25.03.2026 10:29 | โœ… | diff --git a/buildargs.env b/buildargs.env index dad5f2a..c2767fc 100644 --- a/buildargs.env +++ b/buildargs.env @@ -1,26 +1,21 @@ ## BUILD STAGE -BUILD_TAG=1.00 -BUILD_BASE_IMAGE=alpine:${BUILD_TAG} -## Examples for BUILD_BASE_IMAGE -# alpine:${BUILD_TAG} -# git.pi-farm.de/pi-farm/docker-baseimage-alpine:v${BUILD_TAG} -#BUILD_ALPINE_ARCH_AMD64=x86_64 -#BUILD_ALPINE_ARCH_AARCH64=aarch64 -#BUILD_S6_ARCH_amd64=x86_64 -#BUILD_S6_ARCH_aarch64=aarch64 -#BUILD_S6_OVERLAY_VERSION=3.2.0.2 -#BUILD_MAINTAINER=pi-farm -#BUILD_APP_VERSION=v${BUILD_TAG} -#BUILD_APP_NAME=basimage-alpine -#BUILD_APP_USER=pi -#BUILD_APP_GID=1000 +BUILD_TAG=0.6.2 +BUILD_TAG_LATEST=n +BUILD_BASE_IMAGE=git.pi-farm.de/pi-farm/docker-baseimage-debian:trixie-slim +BUILD_RUNTIME_IMAGE=git.pi-farm.de/pi-farm/docker-baseimage-debian:trixie-slim +BUILD_MAINTAINER=pi-farm +BUILD_APP_VERSION=${BUILD_TAG} +BUILD_APP_GIT=https://github.com/oschonrock/hibp.git +BUILD_APP_NAME=hibp +BUILD_APP_USER=pi +BUILD_APP_GID=1000 + ## ENV STAGE ENV_TZ=Europe/Berlin ENV_PUID=1000 ENV_PGID=1000 -# VOL_CONFIG=./config:/config -# VOL_DATA=./data:/data -# PORT_WEB=8080:80 -#PUSH=gitea,dockerhub -DESCRIPTION="Example example example" - +VOL_DATA=/data +PORT_WEB=8082:8082 +PUSH=gitea +#,dockerhub +DESCRIPTION="Docker implementation of https://github.com/oschonrock/hibp.git." \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 8b13789..1aebe63 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1 +1,13 @@ - +services: + hibp-docker: + image: git.pi-farm.de/pi-farm/hibp-docker:0.6.2 + container_name: hibp-docker + restart: unless-stopped + ports: + - 8082:8082 + environment: + - TZ=Europe/Berlin + - PUID=1000 + - PGID=1000 + volumes: + - /data diff --git a/root/etc/s6-overlay/s6-rc.d/init-hibp/dependencies.d/init-config b/root/etc/s6-overlay/s6-rc.d/init-hibp/dependencies.d/init-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/init-hibp/run b/root/etc/s6-overlay/s6-rc.d/init-hibp/run new file mode 100755 index 0000000..cf84335 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-hibp/run @@ -0,0 +1,15 @@ +#!/usr/bin/with-contenv bash + +echo "Start: init-hibp run script" + +mkdir -p /data + +if [ ! -f /data/*.bin ]; then + echo "Downloading /data/hibp_all.sha1.bin" + hibp-download /data/hibp_all.sha1.bin +fi + +echo "Set permissions to PUID: ${PUID:-911} and PGID: ${PGID:-1000}" +chown -R "${PUID:-911}:${PGID:-1000}" /data + +echo "Finish: init-hibp" \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-hibp/type b/root/etc/s6-overlay/s6-rc.d/init-hibp/type new file mode 100644 index 0000000..3d92b15 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-hibp/type @@ -0,0 +1 @@ +oneshot \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-hibp/up b/root/etc/s6-overlay/s6-rc.d/init-hibp/up new file mode 100644 index 0000000..a6158a3 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-hibp/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-hibp/run \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/svc-hibp/dependencies.d/init-services b/root/etc/s6-overlay/s6-rc.d/svc-hibp/dependencies.d/init-services new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-hibp/run b/root/etc/s6-overlay/s6-rc.d/svc-hibp/run new file mode 100755 index 0000000..e36cc28 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-hibp/run @@ -0,0 +1,3 @@ +#!/usr/bin/with-contenv bash + +exec hibp-server --bind-address=0.0.0.0 --sha1-db=/data/hibp_all.sha1.bin \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/svc-hibp/type b/root/etc/s6-overlay/s6-rc.d/svc-hibp/type new file mode 100644 index 0000000..1780f9f --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-hibp/type @@ -0,0 +1 @@ +longrun \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-hibp b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-hibp new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-hibp b/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-hibp new file mode 100644 index 0000000..e69de29