well, fixed some problems with path etc but works now
This commit is contained in:
parent
256e9b9fc6
commit
e93831009c
4 changed files with 7 additions and 12 deletions
|
|
@ -1,15 +1,15 @@
|
||||||
ARG ALPINE_VERSION=3.21
|
ARG ALPINE_VERSION=3.21
|
||||||
FROM alpine:${ALPINE_VERSION}
|
FROM alpine:${ALPINE_VERSION}
|
||||||
|
|
||||||
|
# Re-declare after FROM — build ARGs don't persist across FROM
|
||||||
ARG SUPERCRONIC_VERSION=0.2.33
|
ARG SUPERCRONIC_VERSION=0.2.33
|
||||||
# TARGETARCH is auto-set by buildx per platform: "amd64", "arm64", etc.
|
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
||||||
RUN apk add --no-cache docker-cli
|
RUN apk add --no-cache docker-cli
|
||||||
|
|
||||||
ADD https://github.com/aptible/supercronic/releases/download/v${SUPERCRONIC_VERSION}/supercronic-linux-${TARGETARCH} \
|
ADD https://github.com/aptible/supercronic/releases/download/v${SUPERCRONIC_VERSION}/supercronic-linux-${TARGETARCH} \
|
||||||
/usr/local/bin/supercronic
|
/usr/local/bin/supercronic
|
||||||
RUN chmod +x /usr/local/bin/supercronic
|
RUN chmod 755 /usr/local/bin/supercronic
|
||||||
|
|
||||||
# Match GID to your host's docker group. Check with: stat -c '%g' /var/run/docker.sock
|
# Match GID to your host's docker group. Check with: stat -c '%g' /var/run/docker.sock
|
||||||
ARG DOCKER_GID=999
|
ARG DOCKER_GID=999
|
||||||
|
|
|
||||||
3
build.sh
3
build.sh
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
IMAGE="${IMAGE:-docker-pruner}"
|
IMAGE="${IMAGE:-registry.domandoman.xyz/cannibal}"
|
||||||
TAG="${TAG:-latest}"
|
TAG="${TAG:-latest}"
|
||||||
DOCKER_GID="${DOCKER_GID:-$(stat -c '%g' /var/run/docker.sock)}"
|
DOCKER_GID="${DOCKER_GID:-$(stat -c '%g' /var/run/docker.sock)}"
|
||||||
SUPERCRONIC_VERSION="${SUPERCRONIC_VERSION:-0.2.33}"
|
SUPERCRONIC_VERSION="${SUPERCRONIC_VERSION:-0.2.33}"
|
||||||
|
|
@ -25,4 +25,5 @@ docker buildx build \
|
||||||
--build-arg SUPERCRONIC_VERSION="${SUPERCRONIC_VERSION}" \
|
--build-arg SUPERCRONIC_VERSION="${SUPERCRONIC_VERSION}" \
|
||||||
--build-arg DOCKER_GID="${DOCKER_GID}" \
|
--build-arg DOCKER_GID="${DOCKER_GID}" \
|
||||||
--tag "${IMAGE}:${TAG}" \
|
--tag "${IMAGE}:${TAG}" \
|
||||||
|
--push \
|
||||||
.
|
.
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,8 @@
|
||||||
services:
|
services:
|
||||||
cannibal:
|
cannibal:
|
||||||
image: cannibal:latest
|
image: registry.domandoman.xyz/cannibal:latest
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
args:
|
|
||||||
DOCKER_GID: "${DOCKER_GID:-999}"
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
PRUNE_SCHEDULE: "0 3 * * *" # every day at 3am
|
PRUNE_SCHEDULE: "0 3 * * *" # every day at 3am
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
group_add:
|
|
||||||
- "${DOCKER_GID:-999}"
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,6 @@ echo "Docker pruner starting as $(whoami). Schedule: ${PRUNE_SCHEDULE}"
|
||||||
|
|
||||||
# Write crontab from env var at runtime
|
# Write crontab from env var at runtime
|
||||||
CRONTAB_FILE=/tmp/crontab
|
CRONTAB_FILE=/tmp/crontab
|
||||||
echo "${PRUNE_SCHEDULE} docker system prune -af >> /tmp/prune.log 2>&1" > "${CRONTAB_FILE}"
|
echo "${PRUNE_SCHEDULE} /bin/sh -c '/usr/bin/docker system prune -af >> /tmp/prune.log 2>&1'" > "${CRONTAB_FILE}"
|
||||||
|
|
||||||
exec supercronic "${CRONTAB_FILE}"
|
exec /usr/local/bin/supercronic "${CRONTAB_FILE}"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue