Skip to content

Commit 0e935e7

Browse files
committed
create dev-bun branch
1 parent 19f8b8b commit 0e935e7

File tree

7 files changed

+413
-2122
lines changed

7 files changed

+413
-2122
lines changed

.github/workflows/docker-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name: Docker
77

88
on:
99
push:
10-
branches: ["main", "dev"]
10+
branches: ["dev-bun"]
1111
tags: [ 'v*.*.*' ]
1212

1313
env:

Dockerfile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Creates a runnable environment with a dedicated server and trakman
2-
FROM node:lts-alpine
2+
FROM oven/bun:alpine
33
# create directory, install xml editing tool and setup non-root user
44
RUN adduser -h /app/server -s /bin/sh -D -u 1001 server && \
5-
apk add xmlstarlet su-exec && \
6-
5+
apk add xmlstarlet su-exec
76
USER server
87
WORKDIR /app/server
98
# copy useful trakman files and entrypoint command
@@ -20,9 +19,8 @@ RUN wget -O serv.zip http://files2.trackmaniaforever.com/TrackmaniaServer_2011-0
2019
Readme_Dedicated.html RemoteControlExamples TrackmaniaServer.exe manialink_dedicatedserver.txt
2120
# generate file hashes, get trakman dependencies and build
2221
WORKDIR /app/server/trakmanbk
23-
RUN node Update.js && \
24-
npm i && \
25-
npm run build
22+
RUN bun Update.js && \
23+
bun i
2624
WORKDIR /app/server
2725
# backup important files to prevent them being deleted by mounting the volume
2826
RUN mv GameData/Config/dedicated_cfg.txt dedicated_cfg.txt.bk && \

bun.lock

Lines changed: 399 additions & 0 deletions
Large diffs are not rendered by default.

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
trakman:
3-
image: borecek/trakman:main
3+
image: borecek/trakman:dev-bun
44
container_name: trakman-server
55
restart: unless-stopped
66
volumes:

docker_run.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fi
3636
if find /app/server/trakman -mindepth 1 -maxdepth 1 | read; then
3737
echo 'Trakman exists. Attempting update...'
3838
cd trakman || exit
39-
node Update.js /app/server/trakmanbk/.hashes.json
39+
bun Update.js /app/server/trakmanbk/.hashes.json
4040
if [ $? -gt 0 ]; then
4141
chown server:server update.log
4242
echo 'Update not fully successful, please stop the container.'
@@ -74,12 +74,13 @@ echo "#!/bin/sh
7474
echo 'Server exited with code ' $?
7575
echo 'Restarting...'
7676
done) &
77-
npm i --prefix /app/server/trakman
78-
npm run build --prefix /app/server/trakman
79-
chmod -R a+w /app/server
8077
cd trakman
81-
trap 'echo Terminating; npx pm2 stop 0; npx pm2 kill; exit' SIGTERM SIGINT
82-
npx pm2 start ./built/src/Main.js --name Trakman
78+
bun i
79+
chmod -R a+w /app/server
80+
sleep 1 # wait for dedicated server to finish loading
81+
trap 'echo Terminating; bun pm2 stop 0; bun pm2 kill; exit' SIGTERM SIGINT
82+
bun pm2 ls # idk why but the controller starts not without this
83+
bun pm2 start --interpreter bun src/Main.ts --name Trakman
8384
wait $!" > run.sh
8485
chown server:server run.sh
8586
chmod 766 run.sh

0 commit comments

Comments
 (0)