-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
239 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Build Image | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
default: 'false' | ||
description: 'Version to build' | ||
required: false | ||
|
||
env: | ||
ENDPOINT: "rix1337/docker-myjd-api" | ||
|
||
jobs: | ||
version-check: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
output: ${{ steps.get-version.outputs.version }} | ||
steps: | ||
- id: get-version | ||
run: | | ||
if [ -z "${{ github.event.inputs.version }}" ]; then VS="false"; else VS=${{ github.event.inputs.version }}; fi | ||
if [[ ${VS} == "false" ]] | ||
then | ||
echo "Grabbing latest myjd-api version from pypi.org" | ||
VERSION=$(curl -Ls https://pypi.org/pypi/myjd-api/json | jq -r .info.version) | ||
else | ||
echo "Using version from workflow_dispatch input" | ||
VERSION=${VS} | ||
fi | ||
echo $VERSION | ||
echo "version=$VERSION" >>$GITHUB_OUTPUT | ||
build: | ||
runs-on: ubuntu-latest | ||
needs: version-check | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: whoan/docker-build-with-cache-action@v6 | ||
id: firstrun | ||
continue-on-error: true | ||
with: | ||
username: "${{ secrets.DOCKERUSER }}" | ||
password: "${{ secrets.DOCKERPASS }}" | ||
image_name: "${{ env.ENDPOINT }}" | ||
image_tag: latest,${{needs.version-check.outputs.output}} | ||
context: "./docker" | ||
stages_image_name: "rix1337/cache-myjd-api-latest" | ||
build_extra_args: "--build-arg=VS=${{needs.version-check.outputs.output}}" | ||
- name: Sleep before retry | ||
if: steps.firstrun.outcome=='failure' | ||
uses: jakejarvis/wait-action@master | ||
with: | ||
time: '1m' | ||
- uses: whoan/docker-build-with-cache-action@v6 | ||
if: steps.firstrun.outcome=='failure' | ||
with: | ||
username: "${{ secrets.DOCKERUSER }}" | ||
password: "${{ secrets.DOCKERPASS }}" | ||
image_name: "${{ env.ENDPOINT }}" | ||
image_tag: latest,${{needs.version-check.outputs.output}} | ||
context: "./docker" | ||
stages_image_name: "rix1337/cache-myjd-api-latest" | ||
build_extra_args: "--build-arg=VS=${{needs.version-check.outputs.output}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Regular base image update check | ||
on: | ||
schedule: | ||
- cron: "0 */6 * * *" | ||
|
||
env: | ||
IMAGE_BASE: lsiobase/alpine.python3 | ||
IMAGE: rix1337/docker-myjd-api | ||
|
||
jobs: | ||
check-base-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Docker Image Update Checker | ||
id: baseupdatecheck | ||
uses: lucacome/[email protected] | ||
with: | ||
base-image: ${{ env.IMAGE_BASE }} | ||
image: ${{ env.IMAGE }} | ||
- name: Trigger Docker Image build | ||
run: | | ||
curl -XPOST -u "${{ secrets.CR_USER }}:${{secrets.CR_PAT}}" -H "Accept: application/vnd.github.v3+json" -H "Content-Type: application/json" https://api.github.com/repos/rix1337/MyJD-API/actions/workflows/BuildImage.yml/dispatches --data '{"ref": "main"}' | ||
if: steps.baseupdatecheck.outputs.needs-updating == 'true' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from myjd_api import web | ||
from myjd_api import run | ||
|
||
if __name__ == '__main__': | ||
web.main() | ||
run.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM ghcr.io/linuxserver/baseimage-alpine:3.18 | ||
MAINTAINER rix1337 | ||
|
||
# Define package name | ||
ARG PACKAGE_NAME=myjd-api | ||
|
||
# build tools | ||
RUN apk add --no-cache build-base jq python3-dev py3-pip | ||
|
||
# Optionally set desired version for the build | ||
ARG VS="false" | ||
RUN echo "VS: ${VS}" | ||
|
||
# setup | ||
RUN pip3 install --upgrade pip \ | ||
&& pip3 install wheel | ||
|
||
# Install specified package version and clean up unneeded packages | ||
RUN if [[ ${VS} == "false" ]] ; then echo "Grabbing latest version from pypi.org" && VERSION=$(curl -Ls https://pypi.org/pypi/${PACKAGE_NAME}/json | jq -r .info.version) ; else echo "Using version from workflow_dispatch input" && VERSION=$VS ; fi && \ | ||
echo $VERSION && \ | ||
pip3 install ${PACKAGE_NAME}=="$VERSION" --no-cache-dir && \ | ||
apk del build-base jq | ||
|
||
# add local files | ||
COPY root/ / | ||
|
||
# volumes and ports | ||
VOLUME /config | ||
EXPOSE 8080 | ||
ENV PYTHONUNBUFFERED=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: '3.3' | ||
services: | ||
docker-myjd-api: | ||
container_name: MyJD-API | ||
ports: | ||
- 'port:8080' | ||
volumes: | ||
- '/path/to/config/:/config:rw' | ||
environment: | ||
- USER=USERNAME | ||
- PASS=PASSWORD | ||
- DEVICE=DEVICENAME | ||
image: rix1337/docker-myjd-api:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
https://github.com/sponsors/rix1337 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
─────────────────────────────────────── | ||
MyJD-API | ||
─────────────────────────────────────── |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/with-contenv bash | ||
|
||
exec myjd_api --docker --jd-user=$USER --jd-pass=$PASS --jd-device=$DEVICE |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.