From 40e38ba70176565ad1d0870c4bfd3db27c5097d4 Mon Sep 17 00:00:00 2001 From: Orion Ellefson Date: Fri, 15 Dec 2023 15:50:19 -0800 Subject: [PATCH] Add Devcontainer (#10) * Remove tabs from .gitmodules Use spaces instead; we are using tabs nowhere else so why here? * Add devcontainer --- .devcontainer/devcontainer.json | 27 +++++++++++++++++ .dockerignore | 1 + .github/workflows/build-devbox.yaml | 46 +++++++++++++++++++++++++++++ .gitmodules | 9 +++--- setup | 2 +- 5 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .dockerignore create mode 100644 .github/workflows/build-devbox.yaml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..11da473 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,27 @@ +// 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": "SeahawkTank", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "ghcr.io/cabrilloroboticsclub/seahawk_2:devcontainer", + // "build": { "dockerfile": "Dockerfile" }, + + // 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": "make devbox-install" + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root", + + //"runArgs": [ + // "--network=host", "-v", "/dev/shm:/dev/shm" + //] +} diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..1f85c5a --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +setup/image/ diff --git a/.github/workflows/build-devbox.yaml b/.github/workflows/build-devbox.yaml new file mode 100644 index 0000000..57ce5f6 --- /dev/null +++ b/.github/workflows/build-devbox.yaml @@ -0,0 +1,46 @@ +name: build-devbox + +on: + push: + tags: + - "devcontainer-*" + workflow_dispatch: {} + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Extract version and branch metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=tag + type=raw,value=devcontainer + type=sha + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: ./setup + file: ./setup/Dockerfile.devcontainer + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.gitmodules b/.gitmodules index e78a953..902abc3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,10 +1,11 @@ [submodule "setup"] - path = setup - url = ../setup.git + path = setup + url = ../setup.git + branch = seahawk_2 update = checkout ignore = none [submodule "source"] - path = src - url = ../ROV.git + path = src + url = ../ROV.git update = checkout ignore = none # maybe change this to `dirty`? diff --git a/setup b/setup index ed6fccd..8a1a299 160000 --- a/setup +++ b/setup @@ -1 +1 @@ -Subproject commit ed6fccd7d7029713dfe2e08d0e23f5f71e19bd7e +Subproject commit 8a1a2991efa8f1d37efbf1cfb15a621f8e289c2f