diff --git a/.devcontainer/devcontainer-build.json b/.devcontainer/devcontainer-build.json new file mode 100644 index 0000000000..df88d65934 --- /dev/null +++ b/.devcontainer/devcontainer-build.json @@ -0,0 +1,73 @@ +{ + "name": "Dash Platform Dev Container", + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, + "customizations": { + "vscode": { + "settings": {}, + "extensions": [ + "arcanis.vscode-zipfs", + "chrmarti.regex", + "davidanson.vscode-markdownlint", + "ms-vscode.cmake-tools", + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "vadimcn.vscode-lldb", + "rust-lang.rust-analyzer", + "tamasfe.even-better-toml", + "zhangyue.rust-mod-generator", + "ms-azuretools.vscode-docker" + ] + } + }, + "remoteUser": "vscode", + "mounts": [ + { + "source": "devcontainer-platform-cargo-registry-index-${devcontainerId}", + "target": "/home/vscode/.cargo/registry", + "type": "volume" + }, + { + "source": "devcontainer-platform-cargo-registry-cache-${devcontainerId}", + "target": "/home/vscode/.cargo/registry/cache", + "type": "volume" + }, + { + "source": "devcontainer-platform-cargo-git-db-${devcontainerId}", + "target": "/home/vscode/.cargo/git/db", + "type": "volume" + }, + { + "source": "devcontainer-platform-target-${devcontainerId}", + "target": "${containerWorkspaceFolder}/target", + "type": "volume" + } + ], + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": "true", + "username": "vscode", + "userUid": "1000", + "userGid": "1000", + "upgradePackages": "true" + }, + "ghcr.io/devcontainers/features/git:1": { + "version": "latest", + "ppa": "false" + }, + "ghcr.io/devcontainers/features/github-cli:1": {}, + "ghcr.io/devcontainers/features/node:1": { + "version": 20, + "installYarnUsingApt": false + }, + "ghcr.io/eitsupi/devcontainer-features/jq-likes:2": {}, + "ghcr.io/devcontainers/features/docker-in-docker:2": {}, + "ghcr.io/schlich/devcontainer-features/starship:0": {}, + }, + "postCreateCommand": { + "git-safe": "git config --global --add safe.directory ${containerWorkspaceFolder}", + "cargo-permissions": "sudo chown -R vscode:vscode /home/vscode/.cargo ${containerWorkspaceFolder}/target" + } +} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 2d0d18ee90..586571ba2b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,74 +1,4 @@ { "name": "Dash Platform Dev Container", - "build": { - "dockerfile": "Dockerfile", - "context": ".." - }, - "customizations": { - "vscode": { - "settings": {}, - "extensions": [ - "arcanis.vscode-zipfs", - "chrmarti.regex", - "davidanson.vscode-markdownlint", - "arcanis.vscode-zipfs", - "ms-vscode.cmake-tools", - "dbaeumer.vscode-eslint", - "esbenp.prettier-vscode", - "vadimcn.vscode-lldb", - "rust-lang.rust-analyzer", - "tamasfe.even-better-toml", - "zhangyue.rust-mod-generator", - "ms-azuretools.vscode-docker" - ] - } - }, - "remoteUser": "vscode", - "mounts": [ - { - "source": "devcontainer-platform-cargo-registry-index-${devcontainerId}", - "target": "/home/vscode/.cargo/registry", - "type": "volume" - }, - { - "source": "devcontainer-platform-cargo-registry-cache-${devcontainerId}", - "target": "/home/vscode/.cargo/registry/cache", - "type": "volume" - }, - { - "source": "devcontainer-platform-cargo-git-db-${devcontainerId}", - "target": "/home/vscode/.cargo/git/db", - "type": "volume" - }, - { - "source": "devcontainer-platform-target-${devcontainerId}", - "target": "${containerWorkspaceFolder}/target", - "type": "volume" - } - ], - "features": { - "ghcr.io/devcontainers/features/common-utils:2": { - "installZsh": "true", - "username": "vscode", - "userUid": "1000", - "userGid": "1000", - "upgradePackages": "true" - }, - "ghcr.io/devcontainers/features/git:1": { - "version": "latest", - "ppa": "false" - }, - "ghcr.io/devcontainers/features/github-cli:1": {}, - "ghcr.io/devcontainers/features/node:1": { - "version": 20, - "installYarnUsingApt": false, - }, - "ghcr.io/eitsupi/devcontainer-features/jq-likes:2": {}, - "ghcr.io/devcontainers/features/docker-in-docker:2": {}, - "ghcr.io/schlich/devcontainer-features/starship:0": {}, - }, - "postCreateCommand": { - "git-safe": "git config --global --add safe.directory ${containerWorkspaceFolder}", - "cargo-permissions": "sudo chown -R vscode:vscode /home/vscode/.cargo ${containerWorkspaceFolder}/target" - } + "image": "ghcr.io/dashpay/platform/devcontainer:0.1.0" } diff --git a/.github/workflows/prebuild-devcontainers.yml b/.github/workflows/prebuild-devcontainers.yml new file mode 100644 index 0000000000..794fa3d4a5 --- /dev/null +++ b/.github/workflows/prebuild-devcontainers.yml @@ -0,0 +1,58 @@ +name: Prebuild Dev Containers + +on: + push: + paths: + - '.devcontainer/**' + - '.github/workflows/prebuild-devcontainers.yml' + - rust-toolchain.toml + - Dockerfile + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: Build and push devcontainer + runs-on: ["self-hosted", "linux", "x64", "ubuntu-platform"] + timeout-minutes: 60 + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Node.JS + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Install skopeo + run: | + sudo apt-get update + sudo apt-get install -y skopeo + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v3 + with: + use: true + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: dashpay + password: ${{ secrets.GHCR_TOKEN }} + + - name: Build and push Platform devcontainer + uses: devcontainers/ci@v0.3 + with: + imageName: ghcr.io/dashpay/platform/devcontainer + imageTag: 0.1.0 + platform: linux/amd64,linux/arm64 + configFile: .devcontainer/devcontainer-build.json + push: always + cacheFrom: ghcr.io/dashpay/platform/devcontainer