create util container

This commit is contained in:
Michael Balsillie 2022-08-22 10:54:01 +12:00
commit cc1c5829de
3 changed files with 104 additions and 0 deletions

75
.woodpecker.yml Normal file
View File

@ -0,0 +1,75 @@
variables:
&vars
- REGISTRY=code.balsillie.net
- REGISTRY_USER=michael
- SHOUTRRR_VERSION=SHOUTRRR_VERSION=v0.6.1
- DOCKERFILE=Dockerfile
- CONTEXT=.
- MATRIX_HOST=matrix.balsillie.net
- MATRIX_PORT=443
- MATRIX_ROOM=!HdSXmuHcBMaYExEfkh:balsillie.net
workspace:
base: /git
path: pipeline
clone:
git:
image: woodpeckerci/plugin-git
pipeline:
docker-build:
image: docker:latest
when:
- event: tag
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
*vars
secrets:
- source: REGISTRY_PASSWORD
target: REGISTRY_PASSWORD
commands:
- echo $REGISTRY_PASSWORD | docker login $REGISTRY -u $REGISTRY_USER --password-stdin
- docker build
-t $REGISTRY/${CI_REPO}:${CI_COMMIT_TAG}
-t $REGISTRY/${CI_REPO}:$(date +%F_%H-%M)
-t $REGISTRY/${CI_REPO}:latest
--pull
--build-arg $${SHOUTRRR_VERSION}
-f $${DOCKERFILE}
$${CONTEXT}
- docker push -a $REGISTRY/${CI_REPO}
notify-matrix-success:
image: code.balsillie.net/containers/woodpecker-util
pull: false
when:
- event: tag
status: [ success ]
environment:
*vars
secrets:
- source: MATRIX_ACCESS_TOKEN
target: MATRIX_ACCESS_TOKEN
commands:
- shoutrrr send
--url matrix://$${MATRIX_ACCESS_TOKEN}@$${MATRIX_HOST}:$${MATRIX_PORT}/?rooms=$${MATRIX_ROOM}
--message "New image build of ${CI_REPO}, ${CI_COMMIT_TAG}, has been completed and pushed."
notify-matrix-failure:
image: code.balsillie.net/containers/woodpecker-util
pull: false
when:
- event: tag
status: [ failure ]
environment:
*vars
secrets:
- source: MATRIX_ACCESS_TOKEN
target: MATRIX_ACCESS_TOKEN
commands:
- shoutrrr send
--url matrix://$${MATRIX_ACCESS_TOKEN}@$${MATRIX_HOST}:$${MATRIX_PORT}/?rooms=$${MATRIX_ROOM}
--message "New image build of ${CI_REPO}, ${CI_COMMIT_TAG}, has failed."

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
ARG SHOUTRRR_VERSION=v0.6.1
FROM golang:bullseye AS builder
RUN git clone https://github.com/containrrr/shoutrrr.git shoutrrr \
cd ./shoutrrr \
git checkout ${SHOUTRRR_VERSION} \
go build -o /output ./shoutrrr
FROM debian:11-slim
RUN apt-get update && \
apt-get install -y bash curl jq ca-certificates && \
rm -rf /var/lib/apt/lists/*
RUN ln -sf /bin/bash /bin/sh
WORKDIR /root
COPY --from=builder /output ./shoutrrr
RUN chmod +x /root/shoutrrr/shoutrrr && \
ln -sf /root/shoutrrr/shoutrrr /usr/bin/shoutrrr

12
README.md Normal file
View File

@ -0,0 +1,12 @@
[![status-badge](https://pipeline.balsillie.net/api/badges/containers/woodpecker-util/status.svg)](https://pipeline.balsillie.net/containers/woodpecker-util)
Utility container for use in Woodpecker CI builds.
Debian:11-slim base with the following additional packchangesages:
- Default to BASH shell.
- shoutrrr installed from source
- Packages installed from repo:
- curl
- jq
- ca-certificates