diff --git a/.github/workflows/build.addonbase10.yaml b/.github/workflows/build.addonbase10.yaml new file mode 100644 index 0000000..bdc2b20 --- /dev/null +++ b/.github/workflows/build.addonbase10.yaml @@ -0,0 +1,42 @@ +#### Publish tags to docker hub +name: 📦 Deploy to netdaemon_addonbase .NET 10 +on: + workflow_dispatch: + +jobs: + deploy: + name: 📦 Deploy to netdaemon_base + runs-on: ubuntu-latest + environment: CI - release environment + steps: + - name: 📤 Checkout the repository + uses: actions/checkout@main + - name: 📎 Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: 🔧 Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + - name: 🧰 Available platforms + run: echo ${{ steps.buildx.outputs.platforms }} + + - name: 🔓 Login to Docker hub + uses: docker/login-action@v1.10.0 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + - name: 🔓 Login to GitHub Container Registry + uses: docker/login-action@v1.10.0 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: 🛠️ Run Buildx + run: | + docker buildx build \ + --platform linux/arm,linux/arm64,linux/amd64 \ + --output "type=image,push=true" \ + --no-cache \ + --file ./addon_base/Dockerfile10 . \ + --compress \ + --tag "netdaemon/netdaemon_addonbase:10" \ + --tag "ghcr.io/net-daemon/netdaemon_addonbase:10" diff --git a/.github/workflows/build.base10.yaml b/.github/workflows/build.base10.yaml new file mode 100644 index 0000000..ef679aa --- /dev/null +++ b/.github/workflows/build.base10.yaml @@ -0,0 +1,42 @@ +#### Publish tags to docker hub +name: 📦 Deploy to netdaemon_base .NET 10 +on: + workflow_dispatch: + +jobs: + deploy: + name: 📦 Deploy to netdaemon_base .NET 10 + runs-on: ubuntu-latest + environment: CI - release environment + steps: + - name: 📤 Checkout the repository + uses: actions/checkout@main + - name: 📎 Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: 🔧 Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + - name: 🧰 Available platforms + run: echo ${{ steps.buildx.outputs.platforms }} + + - name: 🔓 Login to Docker hub + uses: docker/login-action@v1.10.0 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + - name: 🔓 Login to GitHub Container Registry + uses: docker/login-action@v1.10.0 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: 🛠️ Run Buildx + run: | + docker buildx build \ + --platform linux/arm,linux/arm64,linux/amd64 \ + --output "type=image,push=true" \ + --no-cache \ + --file ./base/Dockerfile10 . \ + --compress \ + --tag "netdaemon/netdaemon_base:10" \ + --tag "ghcr.io/net-daemon/netdaemon_base:10" diff --git a/UPGRADE_INSTRUCTIONS.md b/UPGRADE_INSTRUCTIONS.md new file mode 100644 index 0000000..a458906 --- /dev/null +++ b/UPGRADE_INSTRUCTIONS.md @@ -0,0 +1,104 @@ +# Upgrading to a New .NET Version + +## For Humans 👤 +**Use an AI assistant (like GitHub Copilot) to perform this upgrade.** +Simply provide this instruction file to your AI assistant and ask it to upgrade to the next .NET version. + +## For AI Agents 🤖 +This guide provides structured instructions for upgrading NetDaemon Docker images to a new .NET version (e.g., from .NET 10 to .NET 11). + +## AI Agent Instructions + +When upgrading to a new .NET version, create and modify the following files systematically: + +### 1. Create New Dockerfiles + +**ACTION:** Create two new Dockerfile files by copying from the previous version. + +**File 1:** `base/Dockerfile{NEW_VERSION}` +- Source: Copy from `base/Dockerfile{PREVIOUS_VERSION}` +- Required change: Line 2 must be updated +- FROM clause pattern: `FROM mcr.microsoft.com/dotnet/sdk:{NEW_VERSION}.0` +- Example: For .NET 11, use `FROM mcr.microsoft.com/dotnet/sdk:11.0` + +**File 2:** `addon_base/Dockerfile{NEW_VERSION}` +- Source: Copy from `addon_base/Dockerfile{PREVIOUS_VERSION}` +- Required change: Line 2 must be updated +- FROM clause pattern: `FROM ghcr.io/net-daemon/netdaemon_base:{NEW_VERSION}` +- Example: For .NET 11, use `FROM ghcr.io/net-daemon/netdaemon_base:11` + +### 2. Create New GitHub Workflow Files + +**ACTION:** Create two new workflow YAML files by copying from the previous version. + +**File 1:** `.github/workflows/build.base{NEW_VERSION}.yaml` +- Source: Copy from `.github/workflows/build.base{PREVIOUS_VERSION}.yaml` +- Required changes: + - Line ~2: Update workflow name: `name: 📦 Deploy to netdaemon_base .NET {NEW_VERSION}` + - Line ~8: Update job name: `name: 📦 Deploy to netdaemon_base .NET {NEW_VERSION}` + - Line ~36: Update Dockerfile path: `--file ./base/Dockerfile{NEW_VERSION} . \` + - Lines ~38-39: Update image tags to `:{NEW_VERSION}` in both tag lines + +**File 2:** `.github/workflows/build.addonbase{NEW_VERSION}.yaml` +- Source: Copy from `.github/workflows/build.addonbase{PREVIOUS_VERSION}.yaml` +- Required changes: + - Line ~2: Update workflow name: `name: 📦 Deploy to netdaemon_addonbase .NET {NEW_VERSION}` + - Line ~36: Update Dockerfile path: `--file ./addon_base/Dockerfile{NEW_VERSION} . \` + - Lines ~38-39: Update image tags to `:{NEW_VERSION}` in both tag lines + +## AI Agent Execution Checklist + +Execute these tasks in order: + +- [ ] Create `base/Dockerfile{NEW_VERSION}` from previous version +- [ ] Update FROM line in `base/Dockerfile{NEW_VERSION}` to use SDK version `{NEW_VERSION}.0` +- [ ] Create `addon_base/Dockerfile{NEW_VERSION}` from previous version +- [ ] Update FROM line in `addon_base/Dockerfile{NEW_VERSION}` to reference base image `:{NEW_VERSION}` +- [ ] Create `.github/workflows/build.base{NEW_VERSION}.yaml` from previous version +- [ ] Update workflow name, job name, Dockerfile path, and both image tags in base workflow +- [ ] Create `.github/workflows/build.addonbase{NEW_VERSION}.yaml` from previous version +- [ ] Update workflow name, Dockerfile path, and both image tags in addonbase workflow + +## Summary for AI Agents + +**Total files to create:** 4 +- 2 Dockerfiles (base and addon_base) +- 2 GitHub workflow files (build.base and build.addonbase) + +**Pattern matching rule:** Replace all occurrences of the previous version number with the new version number in filenames and file contents, paying special attention to: +- Dockerfile FROM statements +- Workflow file paths +- Docker image tags +- Workflow names and job names + +## Testing Locally + +Before deploying, test the new Dockerfiles locally: + +```bash +# Build the base image +docker build -f base/Dockerfile{VERSION} -t netdaemon_base:{VERSION} . + +# Build the addon base image +docker build -f addon_base/Dockerfile{VERSION} -t netdaemon_addonbase:{VERSION} . +``` + +## Reference: Current Version Pattern + +Repository structure follows this consistent pattern across versions: +- .NET 7: `Dockerfile7`, `build.base7.yaml`, `build.addonbase7.yaml` +- .NET 8: `Dockerfile8`, `build.base8.yaml`, `build.addonbase8.yaml` (if exists) +- .NET 9: `Dockerfile9`, `build.base9.yaml`, `build.addonbase9.yaml` +- .NET 10: `Dockerfile10`, `build.base10.yaml`, `build.addonbase10.yaml` + +**AI Agent Note:** Always use the highest numbered version as the template for creating the next version. + +## Example AI Prompt for Humans + +To upgrade this repository to .NET 11, use this prompt with your AI assistant: + +``` +Please upgrade the NetDaemon Docker repository to .NET 11 following the +UPGRADE_INSTRUCTIONS.md file. Create all necessary Dockerfiles and workflow +files based on the .NET 10 versions. +``` diff --git a/addon_base/Dockerfile10 b/addon_base/Dockerfile10 new file mode 100644 index 0000000..60e1506 --- /dev/null +++ b/addon_base/Dockerfile10 @@ -0,0 +1,14 @@ + +FROM ghcr.io/net-daemon/netdaemon_base:10 + + +RUN mkdir -p /usr/src/bashio \ + && curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v0.14.3.tar.gz" \ + | tar -xzf - --strip 1 -C /usr/src/bashio \ + && mv /usr/src/bashio/lib /usr/lib/bashio \ + && ln -s /usr/lib/bashio/bashio /usr/bin/bashio + +LABEL \ + io.hass.version="VERSION" \ + io.hass.type="addon" \ + io.hass.arch="armhf|aarch64|amd64" diff --git a/base/Dockerfile10 b/base/Dockerfile10 new file mode 100644 index 0000000..1ca668c --- /dev/null +++ b/base/Dockerfile10 @@ -0,0 +1,24 @@ + +FROM mcr.microsoft.com/dotnet/sdk:10.0 + +ENV \ + S6_KEEP_ENV=1 \ + DOTNET_NOLOGO=true \ + DOTNET_CLI_TELEMETRY_OPTOUT=true \ + ASPNETCORE_URLS=http://+:5000 + +# This one is used by the container to start custom assembly +#NETDAEMON__APPLICATION_ASSEMBLY="" + +# Install S6 and the Admin site +RUN apt update && apt install -y \ + jq \ + xz-utils \ + make + +COPY ./base/s6.sh /s6.sh + +RUN chmod 700 /s6.sh +RUN /s6.sh + +ENTRYPOINT ["/init"]