From b63632b8ef5585d859398ca7ee9324f723c5eb79 Mon Sep 17 00:00:00 2001 From: k-taro56 <121674121+k-taro56@users.noreply.github.com> Date: Sat, 6 Jul 2024 13:37:35 +0900 Subject: [PATCH] chore: Update devcontainer.json and Dockerfile for DevChum project --- .devcontainer/Dockerfile | 3 +++ .devcontainer/devcontainer.json | 32 ++++++++++++++++++++++++ .github/dependabot.yml | 22 ++++++++++++++++ .github/workflows/ci-in-devcontainer.yml | 20 +++++++++++++++ .github/workflows/push-devcontainer.yml | 30 ++++++++++++++++++++++ .vscode/extensions.json | 3 +++ 6 files changed, 110 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci-in-devcontainer.yml create mode 100644 .github/workflows/push-devcontainer.yml create mode 100644 .vscode/extensions.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..7678dff --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,3 @@ +FROM mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm + +RUN npm uninstall -g pnpm && corepack enable pnpm diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..512d11c --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,32 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node +{ + "name": "DevChum", + "build": { + "dockerfile": "Dockerfile", + "cacheFrom": "ghcr.io/nid-kt/devchum-devcontainer" + }, + + // 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": "corepack prepare && pnpm i --frozen-lockfile", + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "settings": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true + }, + "extensions": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"] + } + } + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..927f80d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,22 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for more information: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot + +version: 2 +updates: + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: daily + + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "daily" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/ci-in-devcontainer.yml b/.github/workflows/ci-in-devcontainer.yml new file mode 100644 index 0000000..22008f5 --- /dev/null +++ b/.github/workflows/ci-in-devcontainer.yml @@ -0,0 +1,20 @@ +name: CI in DevContainer + +on: + push: + pull_request: + +jobs: + ci-in-devcontainer: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Export + uses: devcontainers/ci@v0.3 + with: + cacheFrom: ghcr.io/nid-kt/devchum-devcontainer + push: never + runCmd: pnpm export diff --git a/.github/workflows/push-devcontainer.yml b/.github/workflows/push-devcontainer.yml new file mode 100644 index 0000000..648852b --- /dev/null +++ b/.github/workflows/push-devcontainer.yml @@ -0,0 +1,30 @@ +name: Push DevContainer + +on: + push: + branches: + - main + +jobs: + push-devcontainer: + runs-on: ubuntu-latest + permissions: + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push DevContainer + uses: devcontainers/ci@v0.3 + with: + imageName: ghcr.io/nid-kt/devchum-devcontainer + cacheFrom: ghcr.io/nid-kt/devchum-devcontainer + push: always diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..d7df89c --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"] +}