diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e69de29 diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 0000000..8ba16ae --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,62 @@ +name: Bug Report +description: Report a bug. +title: "[BUG]: " +labels: [bug, needs triage] + +body: + - type: markdown + attributes: + value: > + Thank you for taking the time to file a bug report! Before creating a new + issue, please make sure to take a few minutes to check the issue tracker + for existing issues about the bug. + + - type: textarea + attributes: + label: "Issue Description" + description: > + Please provide a clear and concise description of what the bug is. + validations: + required: true + + - type: textarea + attributes: + label: "Steps to Reproduce" + description: > + Please provide the steps that should be taken to reproduce the bug. + validations: + required: true + + - type: textarea + attributes: + label: "Expected Behavior" + description: > + Please describe or show an example of the expected behavior. + validations: + required: true + + - type: textarea + attributes: + label: "Error Message" + description: > + Please include the full error message, if any. + placeholder: > + << Full traceback starting from `Traceback: ...` >> + render: bash + + - type: textarea + attributes: + label: "Runtime Environment" + description: > + Please provide a description of the environment in which the error + occurred. + placeholder: > + Raspberry Pi 4 running Ubuntu 22.04 natively. + validations: + required: true + + - type: textarea + attributes: + label: "Additional Context" + description: > + Please provide any additional context needed to understand the bug. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..3ba13e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/documentation.yml b/.github/ISSUE_TEMPLATE/documentation.yml new file mode 100644 index 0000000..3068ca4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation.yml @@ -0,0 +1,46 @@ +name: Documentation Improvement +description: Report an issue related to the project documentation. +title: "[DOC]: " +labels: [documentation, needs triage] + +body: + - type: markdown + attributes: + value: > + Thank you for taking the time to report a documentation issue! Before creating + a new issue, please make sure to take a few minutes to check the issue + tracker for existing issues similar to that being reported. + + - type: dropdown + attributes: + label: Documentation Change Type + description: Please indicate what type of documentation issue you are reporting. + options: + - Adding new documentation to the project + - Changing existing project documentation + - Removing existing project documentation + validations: + required: true + + - type: textarea + attributes: + label: Documentation Location + description: > + Please provide the location of the documentation that should be modified. + + - type: textarea + attributes: + label: Documentation Problem + description: > + Please provide a description of how the documentation needs to be improved. + validations: + required: true + + - type: textarea + attributes: + label: Suggested Change + description: > + Please provide a description of the proposed change and why the proposed change + improves the upon the existing documentation. + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 0000000..e9471bf --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,57 @@ +name: Feature Request +description: Suggest a new idea for the project. +title: "[FEATURE]: " +labels: [enhancement, needs triage] + +body: + - type: markdown + attributes: + value: > + Thank you for taking the time to request a new feature! Before creating + a new issue, please make sure to take a few minutes to check the issue + tracker for existing issues similar to the proposed feature. + + - type: dropdown + attributes: + label: Feature Type + description: Please indicate what type of feature request you would like to propose. + options: + - Adding new functionality to the project + - Changing existing functionality in the project + - Removing existing functionality in the project + validations: + required: true + + - type: textarea + attributes: + label: "Problem Description" + description: > + Please provide a clear and concise description of what problem + the feature would solve. + validations: + required: true + + - type: textarea + attributes: + label: "Feature Description" + description: > + Please provide a description of the proposed feature, using pseudocode + if relevant. + validations: + required: true + + - type: textarea + attributes: + label: "Alternative Solutions" + description: > + Please provide a description of any alternative solutions or features + that would satisfy the feature request. + validations: + required: true + + - type: textarea + attributes: + label: "Additional Context" + description: > + Please provide any additional context (e.g., relevant GitHub issues, + code examples, or references) needed to understand the feature request. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..8d1f140 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,15 @@ +## Changes Made + +Please provide a description of all changes made in this PR and why the changes +are needed. + +## Associated Issues + +Please provide a list of all open issues that this PR will close or contribute +toward closing. + +- Fixes # (issue) + +## Testing + +Please provide a clear and concise description of the testing performed. diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..79fc83a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..4823c16 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,82 @@ +name: Docker + +on: + push: + branches: + - main + pull_request: + paths: + - Dockerfile + - .github/workflows/docker.yaml + workflow_dispatch: + +env: + PUSH: ${{ (github.event_name != 'pull_request') && (github.repository == 'apl-ocean-engineering/foxglove-bridge-docker') }} + +jobs: + docker_build: + strategy: + fail-fast: false + matrix: + ROS_DISTRO: [rolling] + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + env: + IMAGE_ROS_DISTRO: ${{ matrix.ROS_DISTRO }} + IMAGE_GITHUB_REPO: ${{ github.repository }} + steps: + - + name: Checkout repository + uses: actions/checkout@v4 + + - + # Add support for more platforms with QEMU (optional) + # https://github.com/docker/setup-qemu-action + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - + if: env.PUSH == 'true' + name: Log into registry + uses: docker/login-action@v3.3.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # - + # name: Extract Docker metadata + # if: env.PUSH == 'true' + # id: meta + # uses: docker/metadata-action@v5.5.1 + # with: + # images: ghcr.io/${{ github.repository }} + # tags: | + # type=raw,value=${{ matrix.ROS_DISTRO }}-${{ matrix.stage }} + + - if: github.event_name == 'push' + name: Build and push (non PR) + uses: docker/bake-action@v5.5.0 + with: + workdir: .docker + push: ${{ env.PUSH }} + set: | + *.cache-from=type=gha,scope=foxglove + *.cache-to=type=gha,scope=foxglove + + - if: github.event_name == 'pull_request' + name: Build and push (PR) + uses: docker/bake-action@v5.5.0 + with: + workdir: .docker + targets: | + ${{ matrix.stage }} + set: | + *.cache-from=type=gha,scope=foxglove + *.cache-to= diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..2024987 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,34 @@ +name: Formatting (pre-commit) + +on: + pull_request: + push: + branches: + - main + workflow_dispatch: + +jobs: + pre-commit: + name: Format + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install clang-format-14 + run: sudo apt-get install clang-format-14 + + - name: Run pre-commit + uses: pre-commit/action@v3.0.1 + id: precommit + + - name: Upload pre-commit changes + if: failure() && steps.precommit.outcome == 'failure' + uses: rhaschke/upload-git-patch-action@main + with: + name: pre-commit diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..803bf0f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,42 @@ +repos: + - repo: https://github.com/psf/black + rev: 23.1.0 + hooks: + - id: black + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.0.291 + hooks: + - id: ruff + args: ["--fix", "--exit-non-zero-on-fix"] + + - repo: https://github.com/codespell-project/codespell + rev: v2.2.4 + hooks: + - id: codespell + args: ["--write-changes"] + + # Lint: Dockerfile + - repo: https://github.com/hadolint/hadolint + rev: v2.13.0-beta + hooks: + - id: hadolint-docker + entry: hadolint/hadolint:v2.12.1-beta hadolint + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-json + - id: check-toml + - id: check-yaml + - id: check-xml + - id: check-merge-conflict + - id: check-symlinks + - id: debug-statements + - id: destroyed-symlinks + - id: detect-private-key + - id: end-of-file-fixer + - id: mixed-line-ending + - id: trailing-whitespace diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6f655cf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# hadolint global ignore=DL3008 +# DL3008 is "apt version pinning" +ARG ROS_DISTRO=rolling +FROM ros:$ROS_DISTRO-ros-base AS foxglove-bridge + +RUN apt-get -q update \ + && apt-get -q -y upgrade \ + && apt-get -q install --no-install-recommends -y \ + "ros-${ROS_DISTRO}-foxglove-bridge" \ + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf "/var/lib/apt/lists/*" + +CMD ["ros2", "launch", "foxglove_bridge", "foxglove_bridge_launch.xml"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..527f1b8 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# foxglove-bridge-docker + +Extremely trivial Dockerfile wrapper which installs [Foxglove ROS Bridge](https://docs.foxglove.dev/docs/connecting-to-data/ros-foxglove-bridge/) into a ROS2 image. diff --git a/docker-bake.hcl b/docker-bake.hcl new file mode 100644 index 0000000..09649f1 --- /dev/null +++ b/docker-bake.hcl @@ -0,0 +1,42 @@ +# +# Override these variables with environment variables +# e.g. +# +# IMAGE_ROS_DISTRO=iron docker buildx bake +# +# or +# +# export IMAGE_ROS_DISTRO=iron +# docker buildx bake +# +variable "IMAGE_ROS_DISTRO" { default = "rolling" } +variable "IMAGE_GITHUB_REPO" { default = "apl-ocean-engineering/foxglove-bridge" } + +group "default" { + targets = ["foxglove-bridge"] +} + +# +# All images can pull cache from the images published at Github +# or local storage (within the Buildkit image) +# +# ... and push cache to local storage +# +target "foxglove-bridge" { + dockerfile = "Dockerfile" + context = "." + args = { + ROS_DISTRO = "${IMAGE_ROS_DISTRO}" + } + tags = [ + "ghcr.io/${IMAGE_GITHUB_REPO}:${IMAGE_ROS_DISTRO}" + ] + cache_from =[ + "ghcr.io/${IMAGE_GITHUB_REPO}:${IMAGE_ROS_DISTRO}", + "type=local,dest=.docker-cache" + ] + cache_to = [ + "type=local,dest=.docker-cache" + ] + platforms = ["linux/amd64"] +} diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..6fc618f --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,4 @@ +services: + blue: + image: ghcr.io/apl-ocean-engineering:rolling-robot + network_mode: host