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

[no refs]: containerized mcrcon #70

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM alpine:3

# Default variables (see docker.env and README.md) - get latest mcrcon version
ARG MCRCON_HOST=localhost
ARG MCRCON_PORT=25575
ARG MCRCON_PASS

RUN apk --update-cache --no-cache add build-base musl-dev

ADD ./* /tmp/

WORKDIR /tmp
RUN make && make install && rm -rf /tmp/*

WORKDIR /
ENTRYPOINT ["mcrcon"]
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,27 @@ MCRCON_HOST
MCRCON_PORT
MCRCON_PASS
```

#### Docker usage

_See "Usage" for commands._

If you want use rcon with docker, you can do it via script [docker.sh](./docker.sh): it will start an interactive rcon terminal.
Before starting the script, make you sure to edit properly the [env file](./docker.env) with your arguments.

```
./docker.sh
```

Instead, if you want use it as oneshot command, after build you can launch it like below reported:

```
docker run -it --rm --env-file docker.env tiiffi/mcrcon:latest "say Hello Minecraft World"
```

Note: `--rm` arguments helps you to clean docker workspace


###### Notes:
- mcrcon will start in terminal mode if no commands are given
- Command-line options will override environment variables
Expand Down
3 changes: 3 additions & 0 deletions docker.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MCRCON_HOST=localhost
MCRCON_PORT=25575
MCRCON_PASS=CHANGE_ME
4 changes: 4 additions & 0 deletions docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

docker build -t tiiffi/mcrcon:latest .
docker run -it --rm --env-file docker.env tiiffi/mcrcon:latest