Skip to content

Commit

Permalink
add docker microbit-toolchain scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Amerlander committed Jan 31, 2024
1 parent 8428ec2 commit 98fd539
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docker/toolchain.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@echo off

:: Check if Docker is installed
where docker >nul 2>nul
if %errorlevel% neq 0 (
echo Error: Docker is not installed. Please install Docker and try again.
exit /b 1
)

:: Check if the Docker image is already pulled
set DockerImage=ghcr.io/carlosperate/microbit-toolchain:latest
docker images %DockerImage% | findstr /i %DockerImage% >nul 2>nul
if %errorlevel% neq 0 (
echo Pulling Docker image: %DockerImage%
docker pull %DockerImage%
)

:: Run the Docker command
docker run -v %CD%:/home --rm %DockerImage% %*
18 changes: 18 additions & 0 deletions docker/toolchain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# Check if Docker is installed
if ! command -v docker &> /dev/null; then
echo "Error: Docker is not installed. Please install Docker and try again."
exit 1
fi

# Check if the Docker image is already pulled
DOCKER_IMAGE="ghcr.io/carlosperate/microbit-toolchain:latest"

if [[ "$(docker images -q $DOCKER_IMAGE 2> /dev/null)" == "" ]]; then
echo "Pulling Docker image: $DOCKER_IMAGE"
docker pull $DOCKER_IMAGE
fi

# Run the Docker command
docker run -v ${PWD}:/home --rm $DOCKER_IMAGE "$@"

0 comments on commit 98fd539

Please sign in to comment.