diff --git a/.github/.devcontainer/devcontainer.json b/.github/.devcontainer/devcontainer.json new file mode 100644 index 0000000..ce3721e --- /dev/null +++ b/.github/.devcontainer/devcontainer.json @@ -0,0 +1,40 @@ +// For format details, see https://containers.dev +{ + "name": "csi-driver-image dev container", + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + + "otherPortsAttributes": { + "onAutoForward": "silent" + }, + + "features": { + "ghcr.io/devcontainers/features/go:1": { + "version": "1.19" + }, + "ghcr.io/devcontainers/features/kubectl-helm-minikube:1": { + "version": "latest", + "helm": "latest", + "minikube": "none" + }, + "ghcr.io/devcontainers/features/docker-in-docker:2": { + "dockerDashComposeVersion": "v2" + }, + "ghcr.io/devcontainers-contrib/features/kind:1": {} + }, + + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.defaultProfile.linux": "zsh", + "terminal.integrated.profiles.linux": { + "zsh": { + "path": "zsh" + } + } + }, + "extensions": [ + "golang.go" + ] + } + } +} diff --git a/.github/workflows/devcontainer-build-and-push.yaml b/.github/workflows/devcontainer-build-and-push.yaml new file mode 100644 index 0000000..bf6edb0 --- /dev/null +++ b/.github/workflows/devcontainer-build-and-push.yaml @@ -0,0 +1,35 @@ +name: Dev Container Build and Push Image + +on: + push: + branches: + master + paths: + - .github/workflows/devcontainer-build-and-push.yml + - '.github/.devcontainer/**' + pull_request: + paths: + - .github/workflows/devcontainer-build-and-push.yml + - '.github/.devcontainer/**' + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to the GitHub Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Pre-build dev container image + uses: devcontainers/ci@v0.3 + with: + subFolder: .github + imageName: ghcr.io/${{ github.repository }} + cacheFrom: ghcr.io/${{ github.repository }} + push: always