-
Notifications
You must be signed in to change notification settings - Fork 85
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
Dockerize MCGalaxy #577
base: master
Are you sure you want to change the base?
Dockerize MCGalaxy #577
Conversation
Why is both mono and dotnet-sdk here? I may be interpreting this wrongly, but seems like you're trying to make symlinks for various directories from MCGalaxy's folder to folders in data directory. Unfortunately I don't think this approach will work reliably . (e.g. |
I am using Docker multistage builds, so the final image only has mono and the application, and I use the same image for both stages in the build so that users only have to download one image. the dotnet-sdk is needed for msbuild which is only used during the build stage and is discarded immediately on the second Yes, I am making symlinks for various directories into the data directory. I will add the blockprops directory as a volume. The reason for this is to centralize all directories that are needed for persistence into one directory that can easily be volumed instead of having to specify 10-15 different volumes. I purposely did not volume in the plugins directory as I think plugins should be baked into the container as well, in which case one could extend this image, or volume it in if they wanted. Docker is not restricted to voluming files and directories specified in the Dockerfile. ANY file or directory in the container can be mounted in from the host. Specifying volumes in the Dockerfile is more a courtesy. As for plugins creating their own directories is none of our concern as the user of the image would be the only one to know what they were using, so when they spin up the image with a For reference on docker volumes: |
Are you sure dotnet-sdk is necessary? I tried |
You are right, the base image can build just fine with msbuild. Good catch! |
Rather than using a nest of symlinks I've tried to patch the source to allow it to follow Mono's "best practices" so that the current directory and the executable directory are distinct. I think it would be reasonable to enable this configuration with a command line option like ClassiCube's The turning off of the various ID-ten-T checks which make sure the user has downloaded all the DLLs should be replaced with versions that check in the same location the # Patch server to allow it to follow best practices.
# http://www.mono-project.com/docs/getting-started/application-deployment
[ -f CLI/CLIProgram.cs ] &&
sed -i '/\<CurrentDirectory\>.*=/s/^/\/\/PATCH/' \
CLI/CLIProgram.cs
[ -f CLI/CLIProgram.cs ] &&
sed -i '/if.*File.Exists.*MCGalaxy/s/^/if(false) {\/\/PATCH/' \
CLI/CLIProgram.cs
[ -f CLI/Program.cs ] &&
sed -i '/\<CurrentDirectory\>.*=/s/^/\/\/PATCH/' \
CLI/Program.cs
sed -i '/CheckFile.*dll"/s/^/\/\/PATCH/' \
${SERVER}/Server/Server.cs
sed -i '/QueueOnce.InitTasks.UpdateStaffList/s/^/\/\/PATCH/' \
${SERVER}/Server/Server.cs
sed -i '/"[A-Z][A-Za-z0-9]*_.dll");/s::Assembly.GetExecutingAssembly().Location); //PATCH:' \
${SERVER}/Scripting/Scripting.cs
[ -f ${SERVER}/Modules/Compiling/Compiler.cs ] &&
sed -i '/"[A-Z][A-Za-z0-9]*_.dll");/s::Assembly.GetExecutingAssembly().Location); //PATCH:' \
${SERVER}/Modules/Compiling/Compiler.cs
[ -f ${SERVER}/Modules/Compiling/Compiler.cs ] &&
sed -i '/Path.GetFileName(Assembly.GetExecutingAssembly().Location);/s::Assembly.GetExecutingAssembly().Location; //PATCH:' \
${SERVER}/Modules/Compiling/Compiler.cs Edit: Changes in base app (and older versions and a rather weird choice from @UnknownShadow200 ). *3 |
Hi guys, I've worked out an implementation using .NET Core and building a docker container based on that. If you want I could further elaborate on that @UnknownShadow200 From our testing it works fine and we haven't found any impediments yet. |
Sure, might be beneficial to some people (although I personally don't really use Docker or .NET core) |
Hi @UnknownShadow200 I do currently and it's quite beneficial. I've opened #629 and kept changes quite simple. |
Built out basic dockerfile and docker entrypoint.