From 5df1851ae280db1d61bf54703981e27022638234 Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 18 Mar 2025 10:47:49 +0100 Subject: [PATCH] Use gitea package registry. --- .drone.yml | 22 ------------------ .gitea/workflows/release.yml | 45 ++++++++++++++++++++++++++++++++++++ Dockerfile | 8 +++++-- 3 files changed, 51 insertions(+), 24 deletions(-) delete mode 100644 .drone.yml create mode 100644 .gitea/workflows/release.yml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 12557cb..0000000 --- a/.drone.yml +++ /dev/null @@ -1,22 +0,0 @@ -kind: pipeline -name: default - -steps: -- name: build container - image: plugins/docker - settings: - dockerfile: Dockerfile - username: - from_secret: registry-username - password: - from_secret: registry-password - registry: https://cs-registry.ddnss.de - repo: cs-registry.ddnss.de/${DRONE_REPO_OWNER}/apc - cache_from: cs-registry.ddnss.de/${DRONE_REPO_OWNER}/apc:latest - dry_run: false - purge: true - squash: true - compress: true - insecure: false - tags: - - ${DRONE_TAG} \ No newline at end of file diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..2e3443a --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,45 @@ +name: Build apc image + +on: + push: + branches: [ master ] + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: cs-registry.ddnss.de + USER: chris + PASS: q',\H(Od:G3).Xv<#!5P + + +jobs: + Build-and-release-image: + + runs-on: ubuntu-latest + + container: + image: catthehacker/ubuntu:act-latest + + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log into registry + uses: docker/login-action@v3 + with: + registry: https://cs-git.ddnss.de + username: ${{ env.USER }} + password: ${{ env.PASS }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: cs-git.ddnss.de/home/apc + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + env: + ACTIONS_RUNTIME_TOKEN: '' + with: + tags: cs-git.ddnss.de/home/apc:latest + push: true diff --git a/Dockerfile b/Dockerfile index e1276a3..257de00 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ FROM golang:alpine AS build + MAINTAINER chris RUN apk add git --no-cache && \ git clone https://github.com/mdlayher/apcupsd_exporter /tmp/build && \ @@ -6,10 +7,13 @@ RUN apk add git --no-cache && \ go build -o /go/bin/apcupsd_exporter /tmp/build/cmd/apcupsd_exporter/main.go FROM alpine:latest + RUN apk update && apk upgrade && apk add --no-cache libusb apcupsd + COPY apc-deamon.conf /etc/apcupsd/apcupsd.conf COPY entrypoint.sh /sbin/entrypoint.sh COPY --from=build /go/bin/apcupsd_exporter /sbin/apcupsd_exporter -EXPOSE 9162 3551/tcp 3551/udp -ENTRYPOINT ["sh", "/sbin/entrypoint.sh"] +EXPOSE 9162 3551/tcp 3551/udp + +ENTRYPOINT ["sh", "/sbin/entrypoint.sh"]