-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
* Add devcontainer template * Add easy-setup script `setup-devcontainer.sh` * Move `mosquitto` image from `everest-utils` repository * Move `steve` image from `everest-utils` repository * Update README.md Signed-off-by: Andreas Heinrich <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Build and push docker images | ||
|
||
on: | ||
pull_request: {} | ||
push: | ||
branches: | ||
- '**' | ||
tags: | ||
- 'v*' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
DOCKER_DIRECTORY: docker/images | ||
PLATFORMS: | | ||
linux/amd64 | ||
PATH_TO_DEPLOY_DOCKER_IMAGES_WORKFLOW: .github/workflows/deploy-docker-images.yml | ||
|
||
jobs: | ||
env-setup: | ||
# Since env variables can't be passed to reusable workflows, we need to pass them as outputs | ||
name: Setup environment | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
docker_registry: ${{ env.REGISTRY }} | ||
docker_directory: ${{ env.DOCKER_DIRECTORY }} | ||
platforms: ${{ env.PLATFORMS }} | ||
path_to_deploy_docker_images_workflow: ${{ env.PATH_TO_DEPLOY_DOCKER_IMAGES_WORKFLOW }} | ||
steps: | ||
- id: check | ||
run: | | ||
echo "Setting up environment" | ||
mosquitto: | ||
needs: | ||
- env-setup | ||
name: Build and push mosquitto docker image | ||
uses: everest/everest-ci/.github/workflows/deploy-single-docker-image.yml@refactor-docker-images | ||
secrets: | ||
SA_GITHUB_PAT: ${{ secrets.SA_GITHUB_PAT }} | ||
SA_GITHUB_USERNAME: ${{ secrets.SA_GITHUB_USERNAME }} | ||
with: | ||
image_name: ${{ github.event.repository.name }}/mosquitto | ||
directory: ${{ needs.env-setup.outputs.docker_directory }}/mosquitto | ||
docker_registry: ${{ needs.env-setup.outputs.docker_registry }} | ||
github_ref_before: ${{ github.event.before }} | ||
github_ref_after: ${{ github.event.after }} | ||
platforms: ${{ needs.env-setup.outputs.platforms }} | ||
depends_on_paths: | | ||
${{ needs.env-setup.outputs.path_to_deploy_docker_images_workflow }} | ||
steve: | ||
needs: | ||
- env-setup | ||
name: Build and push steve docker image | ||
uses: everest/everest-ci/.github/workflows/deploy-single-docker-image.yml@refactor-docker-images | ||
secrets: | ||
SA_GITHUB_PAT: ${{ secrets.SA_GITHUB_PAT }} | ||
SA_GITHUB_USERNAME: ${{ secrets.SA_GITHUB_USERNAME }} | ||
with: | ||
image_name: ${{ github.event.repository.name }}/steve | ||
directory: ${{ needs.env-setup.outputs.docker_directory }}/steve | ||
docker_registry: ${{ needs.env-setup.outputs.docker_registry }} | ||
github_ref_before: ${{ github.event.before }} | ||
github_ref_after: ${{ github.event.after }} | ||
platforms: ${{ needs.env-setup.outputs.platforms }} | ||
depends_on_paths: | | ||
${{ needs.env-setup.outputs.path_to_deploy_docker_images_workflow }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
read -p "Enter the workspace directory (default is the current directory): " WORKSPACE_DIR | ||
if [ -z "$WORKSPACE_DIR" ]; then | ||
WORKSPACE_DIR="./" | ||
fi | ||
WORKSPACE_DIR=$(realpath -m "$WORKSPACE_DIR") | ||
|
||
read -p "Enter the version of the everest-dev-environment (default is 'main'): " VERSION | ||
if [ -z "$VERSION" ]; then | ||
VERSION="main" | ||
fi | ||
|
||
echo "Create the workspace directory '$WORKSPACE_DIR' if it does not exist" | ||
mkdir -p $WORKSPACE_DIR | ||
|
||
if [ "$(ls -A $WORKSPACE_DIR)" ]; then | ||
# The workspace directory is not empty, warning do you want to continue? | ||
read -p "The workspace directory is not empty, do you want to continue? (y/N): " -r | ||
if [[ $REPLY =~ ^[Nn]$ || $REPLY = "" ]]; then | ||
echo "Exiting.." | ||
exit 1 | ||
elif [[ ! $REPLY =~ ^[Yy]$ ]]; then | ||
echo "Invalid input. Exiting.." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
TMP_DIR="$WORKSPACE_DIR/tmp-everest-dev-environment" | ||
echo "Clone the everest-dev-environment repository to the workspace directory with the version $VERSION, temporarily.." | ||
git clone --quiet --depth 1 --single-branch --branch "$VERSION" https://github.com/EVerest/everest-dev-environment.git "$TMP_DIR" | ||
|
||
echo "Copy the template devcontainer configuration files to the workspace directory" | ||
cp -n -r $TMP_DIR/devcontainer/template/* $WORKSPACE_DIR/ | ||
|
||
echo "Remove the everest-dev-environment repository" | ||
rm -rf "$TMP_DIR" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
version: "3.6" | ||
|
||
volumes: | ||
ocpp-db-data: | ||
external: false | ||
node-red-data: | ||
external: false | ||
|
||
services: | ||
mqtt-server: | ||
# LTODO: update tag | ||
image: ghcr.io/everest/everest-dev-environment/mosquitto:refactor-docker-images | ||
ports: | ||
# allow multiple ports for host to avoid conflicts with other dev environments | ||
- 1883-1983:1883 | ||
- 9001-9101:9001 | ||
|
||
ocpp-db: | ||
image: mariadb:10.4.30 # pinned to patch-version because https://github.com/steve-community/steve/pull/1213 | ||
volumes: | ||
- ocpp-db-data:/var/lib/mysql | ||
ports: | ||
# allow multiple ports for host to avoid conflicts with other dev environments | ||
- 13306-13406:3306 | ||
environment: | ||
MYSQL_RANDOM_ROOT_PASSWORD: "yes" | ||
MYSQL_DATABASE: ocpp-db | ||
MYSQL_USER: ocpp | ||
MYSQL_PASSWORD: ocpp | ||
|
||
steve: | ||
# LTODO: update tag | ||
image: ghcr.io/everest/everest-dev-environment/steve:refactor-docker-images | ||
ports: | ||
# allow multiple ports for host to avoid conflicts with other dev environments | ||
- 8180-8280:8180 | ||
- 8443-8543:8443 | ||
depends_on: | ||
- ocpp-db | ||
|
||
nodered: | ||
image: nodered/node-red | ||
volumes: | ||
- node-red-data:/data | ||
depends_on: | ||
- mqtt-server | ||
ports: | ||
# allow multiple ports for host to avoid conflicts with other dev environments | ||
- 1880-1980:1880 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# syntax=docker/dockerfile:1 | ||
# LTODO: Update tag | ||
FROM ghcr.io/everest/everest-ci/dev-env-base:refactor-docker-images | ||
|
||
RUN sudo apt update | ||
Check failure on line 5 in devcontainer/template/.devcontainer/general-devcontainer/Dockerfile Codacy Production / Codacy Static Code Analysisdevcontainer/template/.devcontainer/general-devcontainer/Dockerfile#L5
|
||
|
||
RUN echo "echo \"🏔️ 🚘 Welcome to the EVerest development environment!\"" >> ${HOME}/.bashrc | ||
Check notice on line 7 in devcontainer/template/.devcontainer/general-devcontainer/Dockerfile Codacy Production / Codacy Static Code Analysisdevcontainer/template/.devcontainer/general-devcontainer/Dockerfile#L7
|
||
RUN echo "echo \"To initialize the EVerest workspace please run the following command:\"" >> ${HOME}/.bashrc | ||
Check notice on line 8 in devcontainer/template/.devcontainer/general-devcontainer/Dockerfile Codacy Production / Codacy Static Code Analysisdevcontainer/template/.devcontainer/general-devcontainer/Dockerfile#L8
|
||
RUN echo "echo \"edm init main\"" >> ${HOME}/.bashrc | ||
Check notice on line 9 in devcontainer/template/.devcontainer/general-devcontainer/Dockerfile Codacy Production / Codacy Static Code Analysisdevcontainer/template/.devcontainer/general-devcontainer/Dockerfile#L9
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"name": "EVerest Debian Devenvironment2", | ||
"dockerComposeFile": ["../docker-compose.yml", "./docker-compose.devcontainer.yml"], | ||
"service": "devcontainer", | ||
"remoteUser": "docker", | ||
"workspaceFolder": "/workspace", | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"terminal.integrated.profiles.linux": { | ||
"bash": { | ||
"path": "/bin/bash", | ||
"icon": "terminal-bash", | ||
"args": ["-l"] | ||
} | ||
}, | ||
"terminal.integrated.defaultProfile.linux": "bash", | ||
"python.pythonPath": "/usr/bin/python3", | ||
"python.defaultInterpreterPath": "/usr/bin/python3", | ||
"editor.rulers": [79, 120], | ||
// RST/Sphinx language server | ||
"esbonio.sphinx.buildDir": "${workspaceFolder}/everest/docs/_build", | ||
"esbonio.sphinx.confDir": "${workspaceFolder}/everest/docs", | ||
// RST | ||
"restructuredtext.preview.scrollEditorWithPreview": false, | ||
"restructuredtext.pythonRecommendation.disabled": true, | ||
"liveServer.settings.root": "/everest/docs/_build/html" | ||
}, | ||
"extensions": [ | ||
// language support CPP | ||
"ms-vscode.cpptools", | ||
// language support cmake | ||
"twxs.cmake", | ||
"ms-vscode.cmake-tools", | ||
// language support python | ||
"ms-python.python", | ||
// language support restructured text | ||
"lextudio.restructuredtext", | ||
"trond-snekvik.simple-rst", | ||
// doc live server | ||
"ritwickdey.liveserver" | ||
] | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: "3.6" | ||
|
||
services: | ||
devcontainer: | ||
build: | ||
context: ./general-devcontainer | ||
dockerfile: Dockerfile | ||
volumes: | ||
- type: bind | ||
source: .. | ||
target: /workspace | ||
command: sleep infinity | ||
environment: | ||
MQTT_SERVER_ADRESS: mqtt-server | ||
MQTT_SERVER_PORT: 1883 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM eclipse-mosquitto:2.0.10 | ||
|
||
COPY mosquitto.conf /mosquitto/config/mosquitto.conf |