Skip to content

Commit

Permalink
Latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanVaughn committed May 4, 2024
1 parent 3be041e commit 203f863
Show file tree
Hide file tree
Showing 16 changed files with 94 additions and 79 deletions.
9 changes: 0 additions & 9 deletions .dockerignore

This file was deleted.

1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

30 changes: 18 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
version: 2

updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: '11:00'
open-pull-requests-limit: 10
- package-ecosystem: docker
directory: "/"
schedule:
interval: daily
time: '11:00'
open-pull-requests-limit: 10
- package-ecosystem: docker
directory: "/"
schedule:
interval: monthly
groups:
all-docker:
patterns:
- "*"

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: monthly
groups:
all-github-actions:
patterns:
- "*"
77 changes: 29 additions & 48 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,63 +4,44 @@ on:
workflow_dispatch:

jobs:
getversions:
get-versions:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}

permissions:
contents: read

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Python 3.10
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"

- name: Get Versions
id: set-matrix
run: |
echo "matrix=$(python3 versionchecker.py)" >> $GITHUB_OUTPUT
buildversions:
needs: getversions
if: ${{ fromJSON(needs.getversions.outputs.matrix).include[0] != null }}
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJSON(needs.getversions.outputs.matrix) }}

steps:
- name: Checkout Code
uses: actions/checkout@v4
id: script
run: python3 dev/versionchecker.py

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker Hub Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Github CR Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# - name: nthnv.me CR Login
# uses: docker/login-action@v3
# with:
# registry: cr.nthnv.me
# username: ${{ secrets.NTHNVCR_USERNAME }}
# password: ${{ secrets.NTHNVCR_PASSWORD }}
outputs:
matrix: ${{ steps.script.outputs.matrix }}

- name: Build and Push
uses: docker/build-push-action@v5
with:
tags: ${{ matrix.images }}
file: ${{ matrix.dockerfile }}
context: .
push: true
build-versions:
needs: get-versions
if: ${{ fromJSON(needs.get-versions.outputs.matrix).include[0] != null }}
strategy:
matrix: ${{ fromJSON(needs.get-versions.outputs.matrix) }}

permissions:
contents: read
packages: write

uses: NathanVaughn/reusable-actions/.github/workflows/docker-build-push.yml@main
with:
platform: linux/amd64
tags: ${{ matrix.tags }}
context: docker
dockerfile: ${{ matrix.dockerfile }}
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
2 changes: 0 additions & 2 deletions .gitignore

This file was deleted.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ Alternatively, you can access the latest version like so:
image: ghcr.io/nathanvaughn/powerpanel-business:remote-latest
```

> **🚨 WARNING 🚨**
> Latest versions are unstable due to the difficulty in testing.
> Use specific tagged versions instead.

## Registry

This image is available from 3 different registries. Choose whichever you want:
Expand Down
30 changes: 30 additions & 0 deletions dev/build_test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import argparse
import os
import subprocess

ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


def main(image_type: str) -> None:
subprocess.run(
[
"docker",
"build",
"-f",
f"Dockerfile.{image_type}",
"-t",
"webtrees:test",
".",
],
cwd=os.path.join(ROOT_DIR, "docker"),
)


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--image-type", default="local", choices=["local", "remote", "both"]
)
args = parser.parse_args()

main(args.image_type)
14 changes: 10 additions & 4 deletions versionchecker.py → dev/versionchecker.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import json
import os

IMAGE_NAME = "powerpanel-business"
VARIANTS = ["local", "remote", "both"]
IMAGES = [
f"docker.io/nathanvaughn/{IMAGE_NAME}",
f"ghcr.io/nathanvaughn/{IMAGE_NAME}",
# f"cr.nthnv.me/library/{IMAGE_NAME}",
]

ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

def main():
# extract version from Dockerfile
with open("Dockerfile", "r") as fp:
with open(os.path.join(ROOT_DIR, "docker", "Dockerfile"), "r") as fp:
lines = fp.readlines()

version = next(
Expand All @@ -36,10 +37,15 @@ def main():
)

matrix_data["include"].append(
{"dockerfile": f"Dockerfile.{variant}", "images": ",".join(tagging_list)}
{"dockerfile": f"Dockerfile.{variant}", "tags": ",".join(tagging_list)}
)

print(json.dumps(matrix_data))
# save output
print(json.dumps(matrix_data, indent=4))

if github_output := os.getenv("GITHUB_OUTPUT"):
with open(github_output, "w") as fp:
fp.write(f"matrixes={json.dumps(matrix_data)}")


if __name__ == "__main__":
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile → docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM docker.io/library/ubuntu:22.04
FROM docker.io/library/ubuntu:24.04

# installer does not like being run from /
WORKDIR "/root"

ENV POWERPANEL_VERSION=490
ENV POWERPANEL_VERSION=4101

ENV ENABLE_LOGGING=false

Expand All @@ -26,7 +26,7 @@ RUN apt-get update && \
usbutils \
--no-install-recommends && \
rm -rf /var/lib/apt/lists/* && \
curl -s -L 'https://dl4jz3rbrsfum.cloudfront.net/software/PPB_Linux%2064bit_v4.9.0.sh' -o ppb-linux-x86_64.sh && \
curl -s -L 'https://dl4jz3rbrsfum.cloudfront.net/software/PPB_Linux%2064bit_v4.10.1.sh' -o ppb-linux-x86_64.sh && \
chmod +x ppb-linux-x86_64.sh && \
# See https://www.ej-technologies.com/resources/install4j/help/doc/installers/options.html
./ppb-linux-x86_64.sh -q -varfile response.varfile && \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 203f863

Please sign in to comment.