From 268d6b27983ca3f7345ad08d84eca9e745e522ab Mon Sep 17 00:00:00 2001 From: gns3 <> Date: Tue, 10 Jun 2025 04:39:32 +0100 Subject: [PATCH] Initial commit --- .forgejo/workflows/build-on-commit.yml | 47 +++++++++++++++++++ .forgejo/workflows/build-on-tag.yml | 46 ++++++++++++++++++ Dockerfile | 10 ++++ Readme.md | 65 ++++++++++++++++++++++++++ entrypoint.sh | 3 ++ 5 files changed, 171 insertions(+) create mode 100644 .forgejo/workflows/build-on-commit.yml create mode 100644 .forgejo/workflows/build-on-tag.yml create mode 100644 Dockerfile create mode 100644 Readme.md create mode 100644 entrypoint.sh diff --git a/.forgejo/workflows/build-on-commit.yml b/.forgejo/workflows/build-on-commit.yml new file mode 100644 index 0000000..fba6d8f --- /dev/null +++ b/.forgejo/workflows/build-on-commit.yml @@ -0,0 +1,47 @@ +name: Build Docker Image on Commit + +on: + push: + branches: + - main + tags: + - '!' # Exclude tags + +jobs: + build-and-publish: + runs-on: docker-builder + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set REPO_VARS + id: repo-url + run: | + echo "REPO_HOST=$(echo "${{ github.server_url }}" | sed 's~http[s]*://~~g')" >> $GITHUB_ENV + echo "REPO_PATH=${{ github.repository }}" >> $GITHUB_ENV + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver: docker-container + driver-opts: | + network=host + + - name: Login to OCI registry + run: | + echo "${{ secrets.OCI_TOKEN }}" | docker login $REPO_HOST -u "${{ secrets.OCI_USER }}" --password-stdin + + - name: Build and push multi-arch Docker images + run: | + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + --tag $REPO_HOST/$REPO_PATH:${{ github.sha }} \ + --tag $REPO_HOST/$REPO_PATH:nightly \ + --push \ + . + + - name: Cleanup + run: | + docker buildx prune -f + docker logout $REPO_HOST \ No newline at end of file diff --git a/.forgejo/workflows/build-on-tag.yml b/.forgejo/workflows/build-on-tag.yml new file mode 100644 index 0000000..012b946 --- /dev/null +++ b/.forgejo/workflows/build-on-tag.yml @@ -0,0 +1,46 @@ +name: Build and Publish Docker Image on Tag + +on: + push: + tags: + - '*' + +jobs: + build-and-publish: + runs-on: docker-builder + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set REPO_VARS + id: repo-url + run: | + echo "REPO_HOST=$(echo "${{ github.server_url }}" | sed 's~http[s]*://~~g')" >> $GITHUB_ENV + echo "REPO_PATH=${{ github.repository }}" >> $GITHUB_ENV + echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver: docker-container + driver-opts: | + network=host + + - name: Login to OCI registry + run: | + echo "${{ secrets.OCI_TOKEN }}" | docker login $REPO_HOST -u "${{ secrets.OCI_USER }}" --password-stdin + + - name: Build and push Docker images + run: | + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + --tag $REPO_HOST/$REPO_PATH:$TAG \ + --tag $REPO_HOST/$REPO_PATH:latest \ + --push \ + . + + - name: Cleanup + run: | + docker buildx prune -f + docker logout $REPO_HOST \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5f1c5ac --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +# use the base VNC image +FROM git.merith.xyz/gns3/base-vnc:latest +## START setting your image here + +# RUN apk add --no-cache firefox-esr + +## STOP setting up your image here +# DO NOT REMOVE AND DO NOT ADD AN "ENTRYPOINT" COMMAND +COPY ./entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh \ No newline at end of file diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..c809073 --- /dev/null +++ b/Readme.md @@ -0,0 +1,65 @@ +# 🖥️ GNS3 VNC Appliance Template + +> **Base Image**: `git.merith.xyz/gns3/base-vnc:latest` +Create custom VNC appliances for GNS3 with automatic startup scripts. + +--- + +## 🚀 Quick Start + +1. **Clone the template**: +```bash +git clone https://git.merith.xyz/gns3/vnc-template.git +cd vnc-template +``` + +2. **Customize your appliance**: +```dockerfile +FROM git.merith.xyz/gns3/base-vnc:latest + +## ADD YOUR CUSTOMIZATIONS HERE ## +RUN apk add --no-cache firefox-esr xterm + +## END CUSTOMIZATION ## +COPY ./entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +``` + +3. **Configure startup** (`entrypoint.sh`): +```bash +#!/bin/bash +# Start your applications automatically: +firefox & # Launch in background +xterm # Keep terminal open +``` + +4. **Build and push**: +```bash +docker build -t your-registry/vnc-firefox:latest . +docker push your-registry/vnc-firefox:latest +``` + +--- + +## 🔧 GNS3 Appliance Configuration + +1. In GNS3, create new **Docker VM** template: + - **General Settings**: + - Name: `Your-Appliance-Name` + - Docker image: `your-registry/vnc-firefox:latest` + - **Network**: + - `eth0` = `Management` (NAT) + - Additional NICs as needed + - **Console**: + - Type: `VNC` + - Port: `5900` + +--- + +## 🧩 Key Components + +| File | Purpose | +|------------------|-------------------------------------------------------------------------| +| `Dockerfile` | Extends base image with your custom tools | +| `entrypoint.sh` | **Auto-starts** when appliance boots (launch your apps/services here) | +| `i3.config` | (In base image) Auto-runs `/entrypoint.sh` on startup | diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..e4891f6 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +xterm \ No newline at end of file