diff --git a/.github/workflows/build-dev-container.yaml b/.github/workflows/build-dev-container.yaml index efec783..3dc9ba3 100644 --- a/.github/workflows/build-dev-container.yaml +++ b/.github/workflows/build-dev-container.yaml @@ -3,7 +3,7 @@ name: "Build dev container" on: push: branches: - - master + - main - develop concurrency: @@ -11,8 +11,8 @@ concurrency: cancel-in-progress: true env: - DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} jobs: list-dir: @@ -38,6 +38,7 @@ jobs: fail-fast: false matrix: dir: ${{fromJson(needs.list-dir.outputs.dir)}} + platform: ["linux/amd64"] steps: - name: Checkout uses: actions/checkout@v4 @@ -50,35 +51,84 @@ jobs: with: use: true - # - name: Login to GitHub Container Registry - # uses: docker/login-action@v2 - # with: - # registry: ghcr.io - # username: ${{ github.repository_owner }} - # password: ${{ secrets.GITHUB_TOKEN }} - - - name: Login to Docker registry + - name: Log in to the Container registry uses: docker/login-action@v3.0.0 with: - username: ${{ env.DOCKER_USERNAME }} - password: ${{ env.DOCKER_PASSWORD }} + 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 }} - name: Build and run Dev Container task uses: devcontainers/ci@v0.3 with: - subFolder: ./templates/${{ matrix.dir }} - imageName: npv2k1/codespace - cacheFrom: npv2k1/codespace:${{ matrix.dir }}-${{ github.ref == 'refs/heads/master' && 'latest' || github.ref_name }} - imageTag: ${{ matrix.dir }}-${{ github.ref == 'refs/heads/master' && 'latest' || github.ref_name }} - platform: linux/amd64,linux/arm64 + subFolder: ./templates${{ matrix.platform == 'linux/arm64' && '-arm' || '' }}/${{ matrix.dir }} + imageName: ghcr.io/pnstack/codespace/${{ matrix.dir }}${{ matrix.platform == 'linux/arm64' && '-arm' || '' }} + cacheFrom: ghcr.io/pnstack/codespace/${{ matrix.dir }}:latest + imageTag: ${{ github.ref == 'refs/heads/main' && 'latest' || steps.meta.outputs.tags }} + platform: ${{ matrix.platform }} push: always - # - name: Build and run Dev Container task - # uses: devcontainers/ci@v0.3 - # with: - # subFolder: ./templates/${{ matrix.dir }} - # imageName: ghcr.io/pnstack/codespace/${{ matrix.dir }} - # cacheFrom: ghcr.io/pnstack/codespace/${{ matrix.dir }}:latest - # imageTag: ${{ github.ref == 'refs/heads/master' && 'latest' || github.ref_name }} - # platform: linux/amd64,linux/arm64 - # # push: always + list-dir-arm: + runs-on: ubuntu-latest + outputs: + dir: ${{ steps.list-dir.outputs.dir }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: List Dir + id: list-dir + uses: pnstack/actions/list-dir@main + with: + dir: templates-arm + + - name: log + run: echo ${{ steps.list-dir.outputs.dir }} + + build-arm: + runs-on: ubuntu-latest + needs: [list-dir-arm] + strategy: + fail-fast: false + matrix: + dir: ${{fromJson(needs.list-dir-arm.outputs.dir)}} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + use: true + + - name: Log in to the Container registry + uses: docker/login-action@v3.0.0 + 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 }} + + - name: Build and run Dev Container task + uses: devcontainers/ci@v0.3 + with: + subFolder: ./templates-arm/${{ matrix.dir }} + imageName: ghcr.io/pnstack/codespace/${{ matrix.dir }}-arm + cacheFrom: ghcr.io/pnstack/codespace/${{ matrix.dir }}:latest + imageTag: ${{ github.ref == 'refs/heads/main' && 'latest' || steps.meta.outputs.tags }} + platform: linux/arm64 + push: always diff --git a/.github/workflows/update-documentation.yaml b/.github/workflows/update-documentation.yaml index bc69968..6976e62 100644 --- a/.github/workflows/update-documentation.yaml +++ b/.github/workflows/update-documentation.yaml @@ -2,14 +2,14 @@ name: "Update Documentation" on: push: branches: - - master + - main workflow_dispatch: jobs: generate: runs-on: ubuntu-latest environment: documentation - if: "github.ref == 'refs/heads/master'" + if: "github.ref == 'refs/heads/main'" steps: - uses: actions/checkout@v3 @@ -51,4 +51,4 @@ jobs: -f body="$message" \ -f head="$branch" \ -f base='main' - fi \ No newline at end of file + fi diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..496ee2c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store \ No newline at end of file diff --git a/templates-arm/terraform/.devcontainer/Dockerfile b/templates-arm/terraform/.devcontainer/Dockerfile new file mode 100644 index 0000000..9f0baa9 --- /dev/null +++ b/templates-arm/terraform/.devcontainer/Dockerfile @@ -0,0 +1 @@ +FROM mcr.microsoft.com/devcontainers/base:jammy \ No newline at end of file diff --git a/templates-arm/terraform/.devcontainer/devcontainer.json b/templates-arm/terraform/.devcontainer/devcontainer.json new file mode 100644 index 0000000..06bbd4a --- /dev/null +++ b/templates-arm/terraform/.devcontainer/devcontainer.json @@ -0,0 +1,34 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu +{ + "name": "Ubuntu", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "build": { + // Path is relative to the devcontainer.json file. + "dockerfile": "Dockerfile" + }, + "features": { + "./local-features/aws-cli": "latest", + "./local-features/terraform": "latest", + // "./local-features/google-cloud-cli": "latest" + // "ghcr.io/devcontainers/features/common-utils": {}, + // "ghcr.io/devcontainers/features/terraform:1": {}, + // "ghcr.io/devcontainers/features/aws-cli:1": {}, + "ghcr.io/devcontainers/features/azure-cli:1": {}, + "ghcr.io/dhoeric/features/google-cloud-cli:1": {} + // "./local-features/ubuntu-dev": "latest" + }, + "runArgs": ["--device=/dev/net/tun"] + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "uname -a", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/templates-arm/terraform/.devcontainer/local-features/aws-cli/devcontainer-feature.json b/templates-arm/terraform/.devcontainer/local-features/aws-cli/devcontainer-feature.json new file mode 100644 index 0000000..0b9574d --- /dev/null +++ b/templates-arm/terraform/.devcontainer/local-features/aws-cli/devcontainer-feature.json @@ -0,0 +1,8 @@ +{ + "id": "aws-cli", + "name": "AWS CLI", + "install": { + "app": "", + "file": "install.sh" + } +} diff --git a/templates-arm/terraform/.devcontainer/local-features/aws-cli/install.sh b/templates-arm/terraform/.devcontainer/local-features/aws-cli/install.sh new file mode 100644 index 0000000..f2543ab --- /dev/null +++ b/templates-arm/terraform/.devcontainer/local-features/aws-cli/install.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip" \ + +unzip awscliv2.zip + +./aws/install + +rm -rf awscliv2.zip aws \ No newline at end of file diff --git a/templates-arm/terraform/.devcontainer/local-features/terraform/devcontainer-feature.json b/templates-arm/terraform/.devcontainer/local-features/terraform/devcontainer-feature.json new file mode 100644 index 0000000..7a00320 --- /dev/null +++ b/templates-arm/terraform/.devcontainer/local-features/terraform/devcontainer-feature.json @@ -0,0 +1,8 @@ +{ + "id": "terraform", + "name": "Terraform", + "install": { + "app": "", + "file": "install.sh" + } +} diff --git a/templates-arm/terraform/.devcontainer/local-features/terraform/install.sh b/templates-arm/terraform/.devcontainer/local-features/terraform/install.sh new file mode 100644 index 0000000..5fecd5f --- /dev/null +++ b/templates-arm/terraform/.devcontainer/local-features/terraform/install.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +curl "https://releases.hashicorp.com/terraform/1.10.5/terraform_1.10.5_linux_arm64.zip" -o "terraform.zip" \ + +unzip terraform.zip + +mv terraform /usr/local/bin \ No newline at end of file diff --git a/templates-arm/terraform/Makefile b/templates-arm/terraform/Makefile new file mode 100644 index 0000000..1a69d87 --- /dev/null +++ b/templates-arm/terraform/Makefile @@ -0,0 +1,2 @@ +build: + devcontainer build --workspace-folder . \ No newline at end of file diff --git a/templates-arm/ubuntu/.devcontainer/devcontainer.json b/templates-arm/ubuntu/.devcontainer/devcontainer.json new file mode 100644 index 0000000..6d44b5b --- /dev/null +++ b/templates-arm/ubuntu/.devcontainer/devcontainer.json @@ -0,0 +1,21 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu +{ + "name": "Ubuntu", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/base:jammy", + "runArgs": ["--device=/dev/net/tun"], + "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "uname -a", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + "remoteUser": "root" +} diff --git a/templates/latex/.devcontainer/devcontainer.json b/templates/latex/.devcontainer/devcontainer.json new file mode 100644 index 0000000..078a81b --- /dev/null +++ b/templates/latex/.devcontainer/devcontainer.json @@ -0,0 +1,49 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/universal +{ + "name": "Default Linux Universal", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + // "image": "mcr.microsoft.com/devcontainers/universal:2-linux", + "image": "mcr.microsoft.com/devcontainers/base:jammy", + "features": { + "ghcr.io/devcontainers/features/common-utils": {}, + + "ghcr.io/devcontainers/features/node:1": { + "nodeGypDependencies": true, + "version": "lts", + "nvmVersion": "latest" + }, + "ghcr.io/devcontainers/features/python:1": { + "version": "3.10" + }, + "ghcr.io/tailscale/codespace/tailscale": {}, + "ghcr.io/devcontainers/features/rust:1": {}, + "ghcr.io/meaningful-ooo/devcontainer-features/fish:1": {}, + "ghcr.io/devcontainers-contrib/features/curl-apt-get:1": {}, + "ghcr.io/devcontainers/features/sshd:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/git:1": { + "version": "latest", + "ppa": "false" + }, + "ghcr.io/devcontainers/features/git-lfs:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/github-cli:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/go:1": { + "version": "latest" + }, + "ghcr.io/devcontainers-contrib/features/neovim-apt-get:1": {}, + "ghcr.io/devcontainers-contrib/features/vscode-server:1": {}, + "ghcr.io/prulloac/devcontainer-features/latex:1": {} + }, + "runArgs": ["--device=/dev/net/tun"], + "customizations": { + "vscode": { + "extensions": ["npv2k1.theme-dracula-gray", "ms-azuretools.vscode-docker"] + } + } +} diff --git a/templates/nix/.devcontainer/devcontainer.json b/templates/nix/.devcontainer/devcontainer.json new file mode 100644 index 0000000..af362e3 --- /dev/null +++ b/templates/nix/.devcontainer/devcontainer.json @@ -0,0 +1,20 @@ + +{ + "name": "nix", + "image": "mcr.microsoft.com/devcontainers/base:jammy", + "features": { + "ghcr.io/devcontainers/features/nix:1":{} + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "uname -a", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + "remoteUser": "root" +} diff --git a/templates/node/.devcontainer/devcontainer.json b/templates/node/.devcontainer/devcontainer.json new file mode 100644 index 0000000..6ab0bbe --- /dev/null +++ b/templates/node/.devcontainer/devcontainer.json @@ -0,0 +1,47 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/universal +{ + "name": "Node Universal", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + // "image": "mcr.microsoft.com/devcontainers/universal:2-linux", + "image": "mcr.microsoft.com/devcontainers/base:jammy", + "features": { + "ghcr.io/devcontainers/features/common-utils": {}, + "ghcr.io/devcontainers/features/node:1": { + "nodeGypDependencies": true, + "version": "lts", + "nvmVersion": "latest" + }, + "ghcr.io/devcontainers/features/git:1": { + "version": "latest", + "ppa": "false" + }, + "ghcr.io/devcontainers/features/git-lfs:1": { + "version": "latest" + }, + "ghcr.io/devcontainers-extra/features/cloudflared:1": { + "version": "latest" + } + }, + "runArgs": [], + "customizations": { + "vscode": { + "extensions": [] + } + } + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "uname -a", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/templates/terraform/.devcontainer/devcontainer.json b/templates/terraform/.devcontainer/devcontainer.json index fa30449..4bd8c89 100644 --- a/templates/terraform/.devcontainer/devcontainer.json +++ b/templates/terraform/.devcontainer/devcontainer.json @@ -11,8 +11,8 @@ "ghcr.io/devcontainers/features/common-utils": {}, "ghcr.io/devcontainers/features/terraform:1": {}, "ghcr.io/devcontainers/features/aws-cli:1": {}, - "ghcr.io/devcontainers/features/azure-cli:1":{}, - "ghcr.io/dhoeric/features/google-cloud-cli:1":{}, + "ghcr.io/devcontainers/features/azure-cli:1": {}, + "ghcr.io/dhoeric/features/google-cloud-cli:1": {} // "./local-features/ubuntu-dev": "latest" }, "runArgs": ["--device=/dev/net/tun"]