|
1 |
| -$ARDUINO_DIR = $args[0] -replace '\\', '/' |
2 |
| -if (-not $ARDUINO_DIR) { |
3 |
| - $ARDUINO_DIR = (Get-Location).Path + '/../' |
| 1 | +# This is an example of how to run the docker container. |
| 2 | +# This script is not part of the container, it is meant to be run on the host machine. |
| 3 | +# Usage: ./run.ps1 <path_to_arduino_esp32> |
| 4 | + |
| 5 | +if (-not (Test-Path -Path (Get-Command docker).Source)) { |
| 6 | + Write-Host "ERROR: Docker is not installed! Please install docker first." |
| 7 | + exit 1 |
| 8 | +} |
| 9 | + |
| 10 | +if ($args.Count -gt 0) { |
| 11 | + $ARDUINO_DIR = $args[0] -replace '\\', '/' |
| 12 | +} else { |
| 13 | + $ARDUINO_DIR = '' |
4 | 14 | }
|
5 | 15 |
|
6 |
| -$ARDUINO_DIR = (Get-Item -Path $ARDUINO_DIR).FullName |
7 | 16 | $DOCKER_ARGS = @()
|
8 | 17 | $DOCKER_ARGS += '-it'
|
9 |
| -$DOCKER_ARGS += '-v', "$ARDUINO_DIR:/arduino-esp32" |
10 | 18 | $DOCKER_ARGS += '-e', 'TERM=xterm-256color'
|
11 |
| -$DOCKER_ARGS += '-e', "HOST_UID=$env:UID" |
| 19 | + |
| 20 | +if ((Test-Path $ARDUINO_DIR)) { |
| 21 | + $DOCKER_ARGS += '-v', "$ARDUINO_DIR:/arduino-esp32" |
| 22 | +} else { |
| 23 | + Write-Output "Warning: Invalid arduino directory: '$ARDUINO_DIR'. Ignoring it." |
| 24 | +} |
12 | 25 |
|
13 | 26 | if ($env:LIBBUILDER_GIT_SAFE_DIR) {
|
14 | 27 | $DOCKER_ARGS += '-e', "LIBBUILDER_GIT_SAFE_DIR=$env:LIBBUILDER_GIT_SAFE_DIR"
|
15 | 28 | }
|
16 | 29 |
|
17 |
| -Write-Output "Running: docker run $($DOCKER_ARGS -join ' ') lucassvaz/esp32-arduino-lib-builder:latest" |
18 |
| -docker run @($DOCKER_ARGS) lucassvaz/esp32-arduino-lib-builder:latest python3 tools/config_editor/app.py |
| 30 | +Write-Output "Running: docker run $($DOCKER_ARGS -join ' ') lucassvaz/esp32-arduino-lib-builder" |
| 31 | +#docker run @($DOCKER_ARGS) lucassvaz/esp32-arduino-lib-builder |
0 commit comments