@echo off
SetLocal EnableDelayedExpansion

set BUILD_DIR=%cd%
set BUILD_DIR=%BUILD_DIR:\=/%
set BUILD_DIR=!BUILD_DIR:%WORKSPACE_DIR%=/workspace!

set OPT_ARG=%*
set OPT_ARG=%OPT_ARG:\=/%
set OPT_ARG=!OPT_ARG:%WORKSPACE_DIR%=/workspace!

if not exist .env.list (
    type nul > ".env.list"
)

docker run -i --rm --env-file .env.list --cap-add=SYS_ADMIN --security-opt apparmor:unconfined -v %WORKSPACE_DIR%:/workspace -w %BUILD_DIR% @docker_image_tag@ %OPT_ARG%
