parent
82f335c595
commit
143bb634f0
@ -0,0 +1,60 @@
|
|||||||
|
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
||||||
|
name: Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- 'docker/**'
|
||||||
|
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'docker/**'
|
||||||
|
|
||||||
|
release:
|
||||||
|
types: [ published ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
name: Build & Push Docker Image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
|
||||||
|
- name: Set up Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Extract Image Metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
with:
|
||||||
|
images: ghcr.io/${{ github.repository }}
|
||||||
|
tags: |
|
||||||
|
type=semver,pattern={{major}}.{{minor}}.{{patch}},value=${{ github.event.release.tag_name }}
|
||||||
|
type=semver,pattern={{major}}.{{minor}},value=${{ github.event.release.tag_name }}
|
||||||
|
type=semver,pattern={{major}},value=${{ github.event.release.tag_name }}
|
||||||
|
|
||||||
|
- name: Login to GHCR
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build & Push Image
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: ./docker
|
||||||
|
push: ${{ github.event_name == 'release' }}
|
||||||
|
no-cache: true
|
||||||
|
build-args: |
|
||||||
|
REPOSITORY=${{ github.repository }}
|
||||||
|
${{ github.event.release.tag_name && format('RELEASE_TAG={0}', github.event.release.tag_name) }}
|
||||||
|
platforms: linux/arm/v7,linux/arm64,linux/amd64
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
@ -0,0 +1 @@
|
|||||||
|
/config/
|
@ -0,0 +1,54 @@
|
|||||||
|
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
|
||||||
|
|
||||||
|
WORKDIR /build
|
||||||
|
|
||||||
|
ARG RELEASE_TAG=latest
|
||||||
|
ARG TARGETPLATFORM
|
||||||
|
ARG REPOSITORY=recyclarr/recyclarr
|
||||||
|
|
||||||
|
RUN apk add unzip
|
||||||
|
|
||||||
|
RUN set -ex; \
|
||||||
|
\
|
||||||
|
# The download path is a bit different when using the latest release instead of a specific
|
||||||
|
# release
|
||||||
|
if [ "$RELEASE_TAG" = "latest" ]; then \
|
||||||
|
download_path="latest/download"; \
|
||||||
|
else \
|
||||||
|
download_path="download/$RELEASE_TAG"; \
|
||||||
|
fi; \
|
||||||
|
\
|
||||||
|
# Determine the runtime from the target platform provided by Docker Buildx
|
||||||
|
case "$TARGETPLATFORM" in \
|
||||||
|
"linux/arm/v7") runtime="linux-musl-arm" ;; \
|
||||||
|
"linux/arm64") runtime="linux-musl-arm64" ;; \
|
||||||
|
"linux/amd64") runtime="linux-musl-x64" ;; \
|
||||||
|
*) echo >&2 "ERROR: Unsupported target platform: $TARGETPLATFORM"; exit 1 ;; \
|
||||||
|
esac; \
|
||||||
|
\
|
||||||
|
# Download and extract the recyclarr binary from the release
|
||||||
|
wget --quiet -O recyclarr.zip "https://github.com/$REPOSITORY/releases/$download_path/recyclarr-$runtime.zip"; \
|
||||||
|
unzip recyclarr.zip;
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
FROM alpine
|
||||||
|
|
||||||
|
# Required by environment and/or dotnet
|
||||||
|
ENV HOME=/config \
|
||||||
|
DOTNET_BUNDLE_EXTRACT_BASE_DIR=/tmp/.net \
|
||||||
|
# Environment variables used by the entrypoint script. These may be overridden from `docker run`
|
||||||
|
# as needed.
|
||||||
|
CRON_SCHEDULE="@daily" \
|
||||||
|
# The GLOBALIZATION variable is so that we do not need libicu installed (saves us ~40MB).
|
||||||
|
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true
|
||||||
|
|
||||||
|
VOLUME /config
|
||||||
|
|
||||||
|
RUN set -ex; \
|
||||||
|
apk add --no-cache busybox-suid su-exec libstdc++; \
|
||||||
|
adduser --disabled-password --home "$HOME" recyclarr;
|
||||||
|
|
||||||
|
COPY --chown=recyclarr:recyclarr --chmod=544 --from=build /build/recyclarr /usr/local/bin
|
||||||
|
COPY --chown=recyclarr:recyclarr --chmod=544 entrypoint.sh /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
@ -0,0 +1,21 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
networks:
|
||||||
|
recyclarr:
|
||||||
|
name: recyclarr
|
||||||
|
external: true
|
||||||
|
|
||||||
|
services:
|
||||||
|
recyclarr:
|
||||||
|
image: ghcr.io/recyclarr/recyclarr
|
||||||
|
container_name: recyclarr
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
- TARGETPLATFORM=linux/amd64
|
||||||
|
init: true
|
||||||
|
networks: [recyclarr]
|
||||||
|
volumes:
|
||||||
|
- ./config:/config
|
||||||
|
environment:
|
||||||
|
CRON_SCHEDULE: "* * * * *"
|
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ ! -f "$HOME/recyclarr.yml" ]; then
|
||||||
|
su-exec recyclarr recyclarr create-config --path "$HOME"
|
||||||
|
fi
|
||||||
|
|
||||||
|
appdata="--app-data \"$HOME\""
|
||||||
|
|
||||||
|
# If the script has any arguments, invoke the CLI instead. This allows the image to be used as a CLI
|
||||||
|
# with something like:
|
||||||
|
#
|
||||||
|
# ```
|
||||||
|
# docker run --rm -v ./config:/config ghcr.io/recyclarr/recyclarr sonarr
|
||||||
|
# ```
|
||||||
|
#
|
||||||
|
if [ "$#" -gt 0 ]; then
|
||||||
|
su-exec recyclarr recyclarr "$@" $appdata
|
||||||
|
else
|
||||||
|
echo "Creating crontab file..."
|
||||||
|
echo "$CRON_SCHEDULE recyclarr sonarr $appdata; recyclarr radarr $appdata" \
|
||||||
|
| crontab -u recyclarr -
|
||||||
|
|
||||||
|
crontab -l -u recyclarr
|
||||||
|
|
||||||
|
echo "Starting cron daemon..."
|
||||||
|
exec crond -f
|
||||||
|
fi
|
Loading…
Reference in new issue