Skip to content
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

Add official Dockerfile to the project #339

Merged
merged 9 commits into from
May 26, 2024
Merged

Add official Dockerfile to the project #339

merged 9 commits into from
May 26, 2024

Conversation

allejo
Copy link
Member

@allejo allejo commented Jan 16, 2024

Creating this PR so that if any discussions need to happen, they can happen here. Right now, I'm just documenting how to use the Dockerfile

Building the container

docker build --build-arg="configure=--enable-custom-plugins-file=''" .

Running the container

docker run -p 5154:5154 -p 5154:5154/udp

allejo and others added 6 commits August 23, 2023 18:32
The Dockerfile now uses a multi-stage build which compiles the source in
one image and then copies binaries into a second clean image. This
reduces the final image size from 758MB to 67.5MB, and is further
reduced to 19.2MB by striping the compiled binaries.

The branch/tag of the Git checkout was required to be specified
previously, but now has a default of 2.4 if not provided.

Custom plugins are automatically copied into the build image and
compiled by including them in a custom_plugins directory.

A directory/volume is created at /data in the final image which can be
mapped to a directory on the host system for configuration, world,
groups, and other files.
Instead of using git inside the build container, just copy the source
directory from the host system. This makes it much easier to test local
changes since it does not need to be committed and pushed first. It also
makes the build process more familiar since custom plugins can just be
added to the plugins/ directory like normal, and configure flags can be
passed to the 'configure' build argument.
* Use alpine:3 instead of alpine:3.18 so we track the latest 3.x version
* Add --no-cache to apk add to keep the image size down
* Remove the unnecessary VOLUME
* Add a plugins build argument as a shortcut for the configure script
--enable-custom-plugins option
@blast007 blast007 added this to the 2.4.28 milestone May 19, 2024
@blast007
Copy link
Member

Is there anything else to add to this before it would get merged?

@allejo allejo marked this pull request as ready for review May 26, 2024 00:22
Copy link
Member Author

@allejo allejo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't approve my own PR but I'm loving your changes @blast007. I think this is ready to be merged in

@blast007 blast007 merged commit 04fc025 into 2.4 May 26, 2024
4 checks passed
@allejo allejo deleted the feature/container branch June 18, 2024 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants