Add Docker image
This commit is contained in:
parent
b5bd2e36b6
commit
dc86e68637
5
.dockerignore
Normal file
5
.dockerignore
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
__pycache__
|
||||||
|
config.yaml
|
||||||
|
cordarr.db
|
||||||
|
.DS_Store
|
||||||
|
notes.txt
|
59
.github/workflows/docker-publish.yml
vendored
Normal file
59
.github/workflows/docker-publish.yml
vendored
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
name: Create and publish a Docker image
|
||||||
|
|
||||||
|
# Run workflow on push events to the main branch.
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ['main']
|
||||||
|
|
||||||
|
# Define the package registry and image name as environment variables.
|
||||||
|
env:
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
|
# Create the single job that builds and publishes the Docker image.
|
||||||
|
jobs:
|
||||||
|
build-and-push-image:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
attestations: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Log in to the Container registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=latest
|
||||||
|
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
id: push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
|
- name: Generate artifact attestation
|
||||||
|
uses: actions/attest-build-provenance@v1
|
||||||
|
with:
|
||||||
|
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
|
||||||
|
subject-digest: ${{ steps.push.outputs.digest }}
|
||||||
|
push-to-registry: false
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
__pycache__
|
__pycache__
|
||||||
config.yaml
|
config.yaml
|
||||||
cordarr.db
|
cordarr.db
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
notes.txt
|
15
README.md
15
README.md
@ -25,7 +25,20 @@
|
|||||||
|
|
||||||
CordArr is a self-hosted Discord bot that allows you to add new movies or shows to your Radarr/Sonarr libraries, and allow users to create temporary Jellyfin accounts on your server.
|
CordArr is a self-hosted Discord bot that allows you to add new movies or shows to your Radarr/Sonarr libraries, and allow users to create temporary Jellyfin accounts on your server.
|
||||||
|
|
||||||
# Instructions
|
# Self-hosting
|
||||||
|
|
||||||
|
## Docker
|
||||||
|
To run Guava in Docker, use the provided [docker-compose.yaml](docker-compose.yaml) file as a template for the container. Use the configuration section below to fill out the necessary information.
|
||||||
|
|
||||||
|
## Bare metal
|
||||||
|
To run Guava on bare metal, follow the steps below.
|
||||||
|
|
||||||
|
1. Install Python 3 and Pip
|
||||||
|
2. Clone this repository
|
||||||
|
3. Install the requirements with `pip install -r requirements.txt`
|
||||||
|
4. Run the `code/bot.py` file
|
||||||
|
5. Input information into the newly created config.yaml file.
|
||||||
|
6. Re-run the `code/bot.py` file.
|
||||||
|
|
||||||
CordArr is built on Python and requires you to install all of the dependencies in the `requirements.txt` file. To do this, you can run the pip install command like `pip install -r requirements.txt`
|
CordArr is built on Python and requires you to install all of the dependencies in the `requirements.txt` file. To do this, you can run the pip install command like `pip install -r requirements.txt`
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ import jsonschema
|
|||||||
import validators
|
import validators
|
||||||
import yaml
|
import yaml
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
import logging
|
import logging
|
||||||
import requests
|
import requests
|
||||||
import sqlite3
|
import sqlite3
|
||||||
@ -103,8 +104,13 @@ def load_config() -> None:
|
|||||||
If the file does not exist, generate it
|
If the file does not exist, generate it
|
||||||
"""
|
"""
|
||||||
database_setup()
|
database_setup()
|
||||||
|
if os.path.exists("/.dockerenv"):
|
||||||
|
file_path = "/config/config.yaml"
|
||||||
|
else:
|
||||||
|
file_path = "config.yaml"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open("config.yaml", "r") as f:
|
with open(file_path, "r") as f:
|
||||||
contents = f.read()
|
contents = f.read()
|
||||||
validate_config(contents)
|
validate_config(contents)
|
||||||
|
|
||||||
|
7
docker-compose.yaml
Normal file
7
docker-compose.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
services:
|
||||||
|
cordarr:
|
||||||
|
container_name: cordarr
|
||||||
|
image: ghcr.io/packetparker/cordarr:latest
|
||||||
|
volumes:
|
||||||
|
- /path/on/system:/config
|
||||||
|
- /path/on/system:/data
|
12
dockerfile
Normal file
12
dockerfile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
FROM python:3.12-slim
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.source="https://git.pkrm.dev/parker/cordarr"
|
||||||
|
LABEL org.opencontainers.image.authors="parker <mailto:contact@pkrm.dev>"
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
|
ENTRYPOINT [ "python" ]
|
||||||
|
CMD [ "-u", "code/bot.py" ]
|
@ -1,9 +1,8 @@
|
|||||||
colorlog==6.8.2
|
colorlog==6.8.2
|
||||||
requests==2.32.0
|
requests==2.32.0
|
||||||
humanize==4.9.0
|
|
||||||
wonderwords==2.2.0
|
wonderwords==2.2.0
|
||||||
|
PyYAML==6.0.2
|
||||||
# validators
|
validators==0.34.0
|
||||||
# jsonschema
|
jsonschema==4.23.0
|
||||||
# pyyaml
|
jsonschema-specifications==2024.10.1
|
||||||
# discord py
|
discord.py==2.4.0
|
Loading…
x
Reference in New Issue
Block a user