mcrcon icon indicating copy to clipboard operation
mcrcon copied to clipboard

[no refs]: containerized mcrcon

Open motoreagattoimburrato opened this issue 3 years ago • 5 comments

Hi,

as you can see, I realized an docker environments for mcrcon application, I hope that it is helpful.

Regards, Luke

motoreagattoimburrato avatar Feb 28 '21 12:02 motoreagattoimburrato

What is the size of the final image? I believe FROM gcc could bloat it quite a bit. Maybe use gcc to build the executable and another image (like busybox:glibc ?) to run it.

nywek avatar Feb 28 '21 18:02 nywek

Hi @Fear837

the size of the final image is: tiiffi/mcrcon latest 1e334f7fcc6f 13 hours ago 1.19GB

I used gcc, instead busybox or alpine, for convenience: at the moment an image like this is useless if is used in an orchestration system and the only way to use that makes sense (obv: my opinion) is locally on own workstation. But I agree that 1.2GB is too much, I'll try with alpine, thanks.

motoreagattoimburrato avatar Mar 01 '21 10:03 motoreagattoimburrato

Update With alpine:3 the size is more contained: tiiffi/mcrcon latest 164139f797ad 4 seconds ago 202MB I'll commit this change

motoreagattoimburrato avatar Mar 01 '21 11:03 motoreagattoimburrato

I would suggest this Dockerfile instead, it results in 7MB size:

FROM alpine:edge AS build

RUN apk add --no-cache build-base musl-dev
ADD . /tmp/
RUN cd /tmp && make && make install

FROM alpine:edge

ENTRYPOINT ["/usr/local/bin/mcrcon"]
COPY --from=build /usr/local/bin/mcrcon /usr/local/bin/mcrcon

tboerger avatar Mar 10 '23 16:03 tboerger

If somebody is able to statically compile the binary you could even use a scratch or busybox image as a base which would reduce the size and potential security issues even more.

tboerger avatar Mar 10 '23 16:03 tboerger