-
Notifications
You must be signed in to change notification settings - Fork 388
Adding containerized linux builds #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is amazing! I was just trying to build reclass on arch last week and gave up. @ko1N Thanks for submitting this, as well as all your work with the wonderful Membase. |
I hope this will not be needed in the future (™) with .NET 5. But currently it looks like ReClass would loose the gui part on linux systems if I switch to .NET 5. With Xamarin as part of .NET I must rewrite the complete gui with XAML. |
That would be great but for the time being this PR makes things a bit simpler for Linux users. Apart from that i also released a Plugin for ReClass that will make it super easy to interact with Windows VMs from Linux which makes this PR a bit more valuable :) |
For #181 I used the docker build and it worked realy great. Only the gcc build was failing. For docker I used
The reason was the diff --git a/Makefile b/Makefile
index 10ab0620..03fef0c7 100644
--- a/Makefile
+++ b/Makefile
@@ -37,12 +37,12 @@ docker_all:
docker_debug:
cd ReClass.NET_Launcher && make docker_debug
cd ReClass.NET && make docker_debug
- docker container run --rm -v ${PWD}:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) gcc:latest bash -c "cd NativeCore/Unix && make debug"
+ sudo docker container run --rm -v ${PWD}:/build:z -w /build -u $(shell id -u):$(shell id -g) gcc:latest bash -c "cd NativeCore/Unix && make debug"
docker_release:
cd ReClass.NET_Launcher && make docker_release
cd ReClass.NET && make docker_release
- docker container run --rm -v ${PWD}:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) gcc:latest bash -c "cd NativeCore/Unix && make release"
+ sudo docker container run --rm -v ${PWD}:/build:z -w /build -u $(shell id -u):$(shell id -g) gcc:latest bash -c "cd NativeCore/Unix && make release"
podman_all:
make podman_debug
diff --git a/ReClass.NET/Makefile b/ReClass.NET/Makefile
index d66fd569..673ce704 100644
--- a/ReClass.NET/Makefile
+++ b/ReClass.NET/Makefile
@@ -22,12 +22,12 @@ update:
mono --runtime=v4.0 ../Dependencies/nuget.exe restore ReClass.NET.csproj -SolutionDirectory ../
docker_debug:
- docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Debug /p:Platform=x86 ReClass.NET.csproj"
- docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Debug /p:Platform=x64 ReClass.NET.csproj"
+ sudo docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u):$(shell id -g) mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Debug /p:Platform=x86 ReClass.NET.csproj"
+ sudo docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u):$(shell id -g) mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Debug /p:Platform=x64 ReClass.NET.csproj"
docker_release:
- docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Release /p:Platform=x86 ReClass.NET.csproj"
- docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Release /p:Platform=x64 ReClass.NET.csproj"
+ sudo docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u):$(shell id -g) mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Release /p:Platform=x86 ReClass.NET.csproj"
+ sudo docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u):$(shell id -g) mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Release /p:Platform=x64 ReClass.NET.csproj"
podman_debug:
podman container run --rm -v ${PWD}/..:/build:z -w /build mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Debug /p:Platform=x86 ReClass.NET.csproj"
diff --git a/ReClass.NET_Launcher/Makefile b/ReClass.NET_Launcher/Makefile
index bc9ddd11..468708ae 100644
--- a/ReClass.NET_Launcher/Makefile
+++ b/ReClass.NET_Launcher/Makefile
@@ -17,10 +17,10 @@ clean_release:
msbuild /t:Clean ReClass.NET_Launcher.csproj
docker_debug:
- docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) mono:latest bash -c "cd ReClass.NET_Launcher && msbuild /p:Configuration=Debug ReClass.NET_Launcher.csproj"
+ sudo docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u):$(shell id -g) mono:latest bash -c "cd ReClass.NET_Launcher && msbuild /p:Configuration=Debug ReClass.NET_Launcher.csproj"
docker_release:
- docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) mono:latest bash -c "cd ReClass.NET_Launcher && msbuild /p:Configuration=Release ReClass.NET_Launcher.csproj"
+ sudo docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u):$(shell id -g) mono:latest bash -c "cd ReClass.NET_Launcher && msbuild /p:Configuration=Release ReClass.NET_Launcher.csproj"
podman_debug:
podman container run --rm -v ${PWD}/..:/build:z -w /build mono:latest bash -c "cd ReClass.NET_Launcher && msbuild /p:Configuration=Debug ReClass.NET_Launcher.csproj" |
Docker shouldn't require to be run with sudo. You can just add your own user to the "docker" group to get access to the docker socket. The -u flag that sets the user is just for convenience so the output directory is owned by your own user and not root (which makes it easier to work with it in the future). Interestingly when i tested it on my Fedora laptop podman just maps it to the proper user from the get go without any quirks. |
To make it simpler to build ReClass.NET on Linux systems this change introduces a way to build ReClass without having to set up GCC or MSBuild (as this process can be a bit tedious on some distributions).
Instead of manually installing those dependencies we just load a docker environment and build them there now.
The new commands are:
make docker_all/docker_debug/docker_release
make podman_all/podman_debug/podman_release
make docker_all
andmake podman_all
will already invoke themake dist
step automatically.