From 80db505a111025a3c3bf6f8a95ab7e4ba1a2cc6b Mon Sep 17 00:00:00 2001 From: Katalina Okano Date: Thu, 3 Dec 2020 12:56:12 -0500 Subject: [PATCH] setup dev containers again --- .devcontainer/devcontainer.json | 34 +++++++++++++++ .github/workflows/dev-container.yml | 53 +++++++++++++++++++++++ hack/dockerfiles/dev-container.Dockerfile | 8 ++++ 3 files changed, 95 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/workflows/dev-container.yml create mode 100644 hack/dockerfiles/dev-container.Dockerfile diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..1041993 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,34 @@ +{ + "name": "Roleypoly (Go, Node)", + "image": "ghcr.io/roleypoly/dev-container:main", + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "dbaeumer.vscode-eslint", + "golang.go", + "hashicorp.terraform", + "firsttris.vscode-jest-runner", + "esbenp.prettier-vscode", + "jpoissonnier.vscode-styled-components", + "eg2.vscode-npm-script", + "christian-kohler.npm-intellisense", + "ms-azuretools.vscode-docker", + "eamodio.gitlens", + "davidanson.vscode-markdownlint", + "stylelint.vscode-stylelint", + "pflannery.vscode-versionlens", + "visualstudioexptteam.vscodeintellicode", + "bungcip.better-toml" + ], + // 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", + // Uncomment when using a ptrace-based debugger like C++, Go, and Rust + // "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], + // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode" +} \ No newline at end of file diff --git a/.github/workflows/dev-container.yml b/.github/workflows/dev-container.yml new file mode 100644 index 0000000..752d1dd --- /dev/null +++ b/.github/workflows/dev-container.yml @@ -0,0 +1,53 @@ +name: Dev Container + +on: + push: + paths: + - hack/dockerfiles/dev-container.Dockerfile + - .github/workflows/dev-container.yml + schedule: + - cron: '0 12 * * 2' # 12 noon every tuesday +jobs: + docker_build: + name: Docker Build & Publish + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + - uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v1 + with: + images: ghcr.io/roleypoly/dev-container + tag-sha: true + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + with: + install: true + + - name: Login to GitHub Packages Docker Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: roleypoly + password: ${{ secrets.GHCR_PAT }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./hack/dockerfiles/dev-container.Dockerfile + push: true + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} diff --git a/hack/dockerfiles/dev-container.Dockerfile b/hack/dockerfiles/dev-container.Dockerfile new file mode 100644 index 0000000..b38ab9f --- /dev/null +++ b/hack/dockerfiles/dev-container.Dockerfile @@ -0,0 +1,8 @@ +FROM mcr.microsoft.com/vscode/devcontainers/go:1.15 + +# Install Node.js +ARG NODE_VERSION="lts/*" +RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1" + +# Install Wrangler +RUN su vscode -c "npm install -g wrangler" \ No newline at end of file