Skip to content

Commit d169c72

Browse files
committed
Refactor Dockerfile to use entrypoint script for server setup and update README for runtime environment variables
1 parent 0db7c34 commit d169c72

3 files changed

Lines changed: 41 additions & 17 deletions

File tree

Dockerfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ RUN unzip hytale-downloader.zip hytale-downloader-linux-amd64
1919
# remove zip file
2020
RUN rm hytale-downloader.zip
2121

22-
# run the hytale downloader cli
23-
RUN ./hytale-downloader-linux-amd64 \
24-
--session-token $HYTALE_SERVER_SESSION_TOKEN \
25-
--identity-token $HYTALE_SERVER_IDENTITY_TOKEN \
26-
--owner-uuid $HYTALE_SERVER_OWNER_UUID
22+
# copy entrypoint script
23+
COPY entrypoint.sh /app/entrypoint.sh
24+
RUN chmod +x /app/entrypoint.sh
2725

2826
# expose default hytale server port
2927
EXPOSE 5520
3028

31-
# run the hytale server
32-
CMD ["java", "-jar", "HytaleServer.jar"]
29+
# run the entrypoint script
30+
ENTRYPOINT ["/app/entrypoint.sh"]

README.md

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,23 @@ Before building or running this container, you'll need:
2222
### 1. Build the Image
2323

2424
```bash
25-
docker build \
26-
--build-arg HYTALE_SERVER_SESSION_TOKEN=<your-session-token> \
27-
--build-arg HYTALE_SERVER_IDENTITY_TOKEN=<your-identity-token> \
28-
--build-arg HYTALE_SERVER_OWNER_UUID=<your-owner-uuid> \
29-
-t hytale-server .
25+
docker build -t hytale-server .
3026
```
3127

3228
### 2. Run the Container
3329

3430
```bash
3531
docker run -d \
3632
-p 5520:5520/udp \
33+
-e HYTALE_SERVER_SESSION_TOKEN=<your-session-token> \
34+
-e HYTALE_SERVER_IDENTITY_TOKEN=<your-identity-token> \
35+
-e HYTALE_SERVER_OWNER_UUID=<your-owner-uuid> \
3736
--name hytale-server \
3837
hytale-server
3938
```
4039

40+
The server files will be automatically downloaded on first start.
41+
4142
> ⚠️ **Important:** Hytale uses the QUIC protocol over **UDP** (not TCP). Make sure to expose the port as UDP.
4243
4344
### 3. Authenticate the Server
@@ -52,7 +53,9 @@ Follow the on-screen instructions to complete authentication via https://account
5253

5354
## Configuration
5455

55-
### Environment Variables (Build Args)
56+
### Environment Variables
57+
58+
These environment variables are required at **runtime** (not build time) to download the server files:
5659

5760
| Variable | Description | Required |
5861
| ------------------------------ | -------------------------- | -------- |
@@ -66,14 +69,17 @@ Follow the on-screen instructions to complete authentication via https://account
6669
| ---- | -------- | -------------------------- |
6770
| 5520 | UDP | Default Hytale server port |
6871

69-
To use a custom port, modify the container's startup command:
72+
To use a custom port, pass additional arguments to the entrypoint:
7073

7174
```bash
7275
docker run -d \
7376
-p 25565:25565/udp \
77+
-e HYTALE_SERVER_SESSION_TOKEN=<your-session-token> \
78+
-e HYTALE_SERVER_IDENTITY_TOKEN=<your-identity-token> \
79+
-e HYTALE_SERVER_OWNER_UUID=<your-owner-uuid> \
7480
--name hytale-server \
7581
hytale-server \
76-
java -jar HytaleServer.jar --assets Assets.zip --bind 0.0.0.0:25565
82+
--bind 0.0.0.0:25565
7783
```
7884

7985
### Volumes
@@ -83,6 +89,9 @@ For data persistence, mount the following directories:
8389
```bash
8490
docker run -d \
8591
-p 5520:5520/udp \
92+
-e HYTALE_SERVER_SESSION_TOKEN=<your-session-token> \
93+
-e HYTALE_SERVER_IDENTITY_TOKEN=<your-identity-token> \
94+
-e HYTALE_SERVER_OWNER_UUID=<your-owner-uuid> \
8695
-v ./universe:/app/universe \
8796
-v ./mods:/app/mods \
8897
-v ./logs:/app/logs \
@@ -117,14 +126,18 @@ Hytale servers require authentication to enable communication with Hytale servic
117126

118127
### JVM Arguments
119128

120-
For better performance, you can customize JVM arguments:
129+
To customize JVM arguments, you can override the entrypoint or set `JAVA_OPTS`:
121130

122131
```bash
123132
docker run -d \
124133
-p 5520:5520/udp \
134+
-e HYTALE_SERVER_SESSION_TOKEN=<your-session-token> \
135+
-e HYTALE_SERVER_IDENTITY_TOKEN=<your-identity-token> \
136+
-e HYTALE_SERVER_OWNER_UUID=<your-owner-uuid> \
125137
--name hytale-server \
138+
--entrypoint /bin/sh \
126139
hytale-server \
127-
java -Xms4G -Xmx8G -XX:AOTCache=HytaleServer.aot -jar HytaleServer.jar --assets Assets.zip
140+
-c "java -Xms4G -Xmx8G -XX:AOTCache=HytaleServer.aot -jar HytaleServer.jar --assets Assets.zip"
128141
```
129142

130143
| Argument | Description |

entrypoint.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
# Download Hytale server files if not already present
4+
if [ ! -f "HytaleServer.jar" ]; then
5+
echo "Downloading Hytale server files..."
6+
./hytale-downloader-linux-amd64 \
7+
--session-token "$HYTALE_SERVER_SESSION_TOKEN" \
8+
--identity-token "$HYTALE_SERVER_IDENTITY_TOKEN" \
9+
--owner-uuid "$HYTALE_SERVER_OWNER_UUID"
10+
fi
11+
12+
# Start the Hytale server
13+
exec java -jar HytaleServer.jar --assets Assets.zip "$@"

0 commit comments

Comments
 (0)