Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions .github/workflows/build-and-push-manually.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
name: Build and Push Dockerfiles manually

on:
push:
branches:
- main
workflow_dispatch:
inputs:
full-name:
type: string
description: "Dockerfile name with full path (e.g. 'this/folder/image/name.Dockerfile')"
required: true
tag:
type: string
description: "Docker image tag (e.g. 'latest', '1.0.0', 'pr-123'). 'manual-' will be prepended to the tag if it is not 'latest'."
required: true
workflow_dispatch:
inputs:
full-name:
type: string
description: "Dockerfile name with full path (e.g. 'this/folder/image/name.Dockerfile')"
required: true
tag:
type: string
description: "Docker image tag (e.g. 'latest', '1.0.0', 'pr-123'). 'manual-' will be prepended to the tag if it is not 'latest'."
required: true

jobs:
verify-arguments:
Expand Down
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"ms-azuretools.vscode-docker",
"ms-vscode-remote.remote-containers"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ function exec_from_git_source_repository() {

local script="$GITHUB_SOURCE_CONTENT_PREFIX/$name.sh"

echo "Downloading $script"

if ! wget -q --spider "$script"; then
echo -e "\x1B[31m[ERROR] Script '$name' not found."
exit 1
Expand Down
59 changes: 59 additions & 0 deletions one/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# ONE-docker RobôCIn

## Description

For all docker images inside this folder, please *enforce* tagging with:

```bash
[...] --tag one/robocin/image-name:version
```

### Containers
- **Devcontainers:** Images contained here should be targeted to `internal` and `dogfood` images, providing development environment and compilation dependencies.
- **Runtime:** Images contained here should be targeted to `prod` environments, providing runtime execution of built binaries and **should** build from [scratch](https://docs.docker.com/build/building/base-images/#create-a-minimal-base-image-using-scratch) to avoid embedded overhead. Note that dynamic linking might not be possible here, please refer to docker [official documentation](https://docs.docker.com/build/building/base-images/#create-a-minimal-base-image-using-scratch).

## Creating an image
Please *enforce* image labeling with `one.metadata`. Your pull request will not be approved otherwise.

```Dockerfile
LABEL one.project="Please refer to one.project section" \
one.type="Please refer to one.type section" \
one.environment="Please refer to one.environment section" \
one.owners="Please refer to one.owners section" \
one.version="Please refer to one.version section" \
one.description="Please refer to \
one.description section" \
optional.namespace.key="value"
```
You can add other labels to your image if needed.

For reference, please see: https://docs.docker.com/reference/dockerfile/#label

### Labeling
| one.label | Type | Values | Description |
|------|-------------|-----------|------------|
| `one.project` | string | `multiple`,`ssim2d`, `ssl`, `vss`, `flying-robots`, `humanoid` | Describes which projects this image supports. |
| `one.type` | string | `devcontainer`,`runtime` | `devcontainer` targeted to local development and possible binary execution. `runtime` targeted to binary execution in resource limited devices.
| `one.environment` | string | `prod`, `internal`, `dogfood` | `prod` are competition ready images. `internal` are development ready images that can be used to day to day development but **should not** be used in competition scenarios. `dogfood` are experimental images on new developments that **should not** be used either on competition nor internal day to day scenarios. Mainly targeted for alpha & validation scenarios. |
| `one.owners` | string |`"robocin@cin.ufpe.br, contributor@cin.ufpe.br"` | Maintainers of the image. Point of contacts for issues with the image. |
| `one.version` | string | `major.minor.patch` | Please follow [semantic versioning](https://semver.org/) guidelines. |
| `one.description` | string | Plain text | Textual description of this image purpose. |

## Publishing
Please make sure images added here are published to [RobôCIn's Docker Hub](https://hub.docker.com/u/robocin) under `one/` tag.

To publish image to Docker Hub, use action [Build and Push manually](https://github.com/robocin/containers/actions/workflows/build-and-push-manually.yaml).

## Usage

> [!WARNING]
> Do not create docker images in your project repository. If you want to create an image for your project, create under `one/` folder. If you already have images, please move & refactor them here.

### On `docker-compose.yaml`
Please use the published image on your docker compose:
```yaml
# docker-compose.yaml
your-container:
container_name: my-container-name
image: one/robocin/image-name:latest
```
23 changes: 23 additions & 0 deletions one/cpp-osrf-ros-jazzy-desktop-full.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM osrf/ros:jazzy-desktop-full

LABEL one.project="multiple" \
one.type="devcontainer" \
one.environment="dogfood" \
one.owner="robocin@cin.ufpe.br, fnap@cin.ufpe.br" \
one.version="1.0.0" \
one.description="This image is RobôCIn's base image for developing \
in linux vanilla + cpp + ros2 in ui-dependent environments."

RUN apt update && apt upgrade -y

RUN apt-get install wget -y

COPY ./scripts/robocin-install.sh /usr/local/bin/robocin-install

RUN robocin-install \
cmake \
ninja \
g++ \
googletest \
llvm \
clang-format
23 changes: 23 additions & 0 deletions one/cpp-ros-jazzy.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM ros:jazzy-ros-base

LABEL one.project="multiple" \
one.type="devcontainer" \
one.environment="dogfood" \
one.owner="robocin@cin.ufpe.br, fnap@cin.ufpe.br" \
one.version="1.0.0" \
one.description="This image is RobôCIn's base image for developing \
in linux vanilla + cpp + ros2 environments."

RUN apt update && apt upgrade -y

RUN apt-get install wget -y

COPY ./scripts/robocin-install.sh /usr/local/bin/robocin-install

RUN robocin-install \
cmake \
ninja \
g++ \
googletest \
llvm \
clang-format
41 changes: 41 additions & 0 deletions one/scripts/robocin-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

function is_root {
[ "${EUID:-$(id -u)}" -eq 0 ];
}

if ! is_root; then
echo -e "\x1B[31m[ERROR] This script requires root privileges."
exit 1
fi

GITHUB_SOURCE_CONTENT_PREFIX="https://raw.githubusercontent.com/robocin/scripts-ubuntu-common/main"

function exec_from_git_source_repository() {
local name="$1"
local args="${*:2}"

local script="$GITHUB_SOURCE_CONTENT_PREFIX/$name.sh"

echo "Downloading $script"

if ! wget -q --spider "$script"; then
echo -e "\x1B[31m[ERROR] Script '$name' not found."
exit 1
fi

bash -c "$(wget -O - $script)" "" "$args"
}

if [ "$#" -eq 0 ]; then
echo -e "\x1B[31m[ERROR] No arguments provided."
exit 1
fi

for ARG in "$@"; do
exec_from_git_source_repository $(echo "$ARG")
if [ $? -ne 0 ]; then
echo -e "\x1B[31m[ERROR] Script '$ARG' failed."
exit 1
fi
done