Skip to content
Open
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
21 changes: 16 additions & 5 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,18 @@
[[ -z "$TARGET_BUILD_ARCH" ]] \
&& target_build_arch=x86 \
|| target_build_arch="$TARGET_BUILD_ARCH"
# Available container runtimes: [docker], podman, other
[[ -z "$CONTAINER_RUNTIME" ]] \
&& container_runtime=docker \
|| container_runtime="$CONTAINER_RUNTIME"
[[ "$container_runtime" == "podman" ]] \
&& volume_suffix=":Z" \
|| volume_suffix=""
[[ "$container_runtime" == "podman" ]] \
&& userns_option="--userns=keep-id" \
|| userns_option=""

docker build \
$container_runtime build \
-t open.mp/build:ubuntu-${ubuntu_version} \
build_ubuntu-${ubuntu_version}/ \
|| exit 1
Expand All @@ -38,13 +48,14 @@ for folder in "${folders[@]}"; do
sudo chown -R 1000:1000 ${folder} || exit 1
done

docker run \
$container_runtime run \
--rm \
-t \
$userns_option \
-w /code \
-v $PWD/..:/code \
-v $PWD/build:/code/build \
-v $PWD/conan2:/home/user/.conan2 \
-v $PWD/..:/code${volume_suffix} \
-v $PWD/build:/code/build${volume_suffix} \
-v $PWD/conan2:/home/user/.conan2${volume_suffix} \
-e CONFIG=${config} \
-e TARGET_BUILD_ARCH=${target_build_arch} \
-e BUILD_SHARED=${build_shared} \
Expand Down
17 changes: 14 additions & 3 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
[[ -z "$UBUNTU_VERSION" ]] \
&& ubuntu_version=22.04 \
|| ubuntu_version="$UBUNTU_VERSION"
# Available container runtimes: [docker], podman, other
[[ -z "$CONTAINER_RUNTIME" ]] \
&& container_runtime=docker \
|| container_runtime="$CONTAINER_RUNTIME"
[[ "$container_runtime" == "podman" ]] \
&& volume_suffix=":Z" \
|| volume_suffix=""
[[ "$container_runtime" == "podman" ]] \
&& userns_option="--userns=keep-id" \
|| userns_option=""


omp_path="build/Output/${config}/Server"
Expand All @@ -25,7 +35,7 @@ if [ $? -ne 0 ]; then
exit 1
fi

docker build \
$container_runtime build \
-t open.mp/run:ubuntu-${ubuntu_version} \
run_ubuntu-${ubuntu_version}/ \
;
Expand All @@ -39,11 +49,12 @@ fi

[ ! -d './data' ] && mkdir data

docker run \
$container_runtime run \
--rm \
-ti \
$userns_option \
-w /data \
-v $PWD/data:/data \
-v $PWD/data:/data${volume_suffix} \
-p 7777:7777 \
-p 7777:7777/udp \
open.mp/run:ubuntu-${ubuntu_version}