style: reformat and normalize file endings

This commit is contained in:
darksaid98 committed 2025-09-16 15:18:25 +02:00
1 parent b7f158436f
commit 65f79fe387
40 files changed
+535 -511

No files matched your search

+1
View File
@@ -1,2 +1,3 @@
# Arma 3
Docker container designed to run Bohemia Interactive's Arma 3 dedicated server.
+1
View File
@@ -1,2 +1,3 @@
# DayZ
Docker container designed to run Bohemia Interactive's DayZ dedicated server.
+20 -20
View File
@@ -1,21 +1,21 @@
FROM --platform=$TARGETOS/$TARGETARCH node:18-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN dpkg --add-architecture i386 \
&& apt update \
&& apt upgrade -y \
&& apt install -y lib32gcc-s1 lib32stdc++6 unzip curl iproute2 tzdata libgdiplus libsdl2-2.0-0:i386 \
&& mkdir /wrapper \
&& npm install --prefix /wrapper ws \
&& useradd -d /home/container -m container
USER container
ENV USER=container HOME=/home/container
WORKDIR /home/container
COPY ./entrypoint.sh /entrypoint.sh
COPY ./wrapper.js /wrapper/wrapper.js
FROM --platform=$TARGETOS/$TARGETARCH node:18-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN dpkg --add-architecture i386 \
&& apt update \
&& apt upgrade -y \
&& apt install -y lib32gcc-s1 lib32stdc++6 unzip curl iproute2 tzdata libgdiplus libsdl2-2.0-0:i386 \
&& mkdir /wrapper \
&& npm install --prefix /wrapper ws \
&& useradd -d /home/container -m container
USER container
ENV USER=container HOME=/home/container
WORKDIR /home/container
COPY ./entrypoint.sh /entrypoint.sh
COPY ./wrapper.js /wrapper/wrapper.js
CMD [ "/bin/bash", "/entrypoint.sh" ]
+106 -94
View File
@@ -1,140 +1,152 @@
#!/usr/bin/env node
var startupCmd = "";
const fs = require("fs");
fs.writeFile("latest.log", "", (err) => {
if (err) console.log("Callback error in appendFile:" + err);
var startupCmd = '';
const fs = require('fs');
fs.writeFile('latest.log', '', (err) => {
if (err) console.log('Callback error in appendFile:' + err);
});
var args = process.argv.splice(process.execArgv.length + 2);
for (var i = 0; i < args.length; i++) {
if (i === args.length - 1) {
startupCmd += args[i];
} else {
startupCmd += args[i] + " ";
}
if (i === args.length - 1) {
startupCmd += args[i];
} else {
startupCmd += args[i] + ' ';
}
}
if (startupCmd.length < 1) {
console.log("Error: Please specify a startup command.");
process.exit();
console.log('Error: Please specify a startup command.');
process.exit();
}
const seenPercentage = {};
function filter(data) {
const str = data.toString();
if (str.startsWith("Loading Prefab Bundle ")) { // Rust seems to spam the same percentage, so filter out any duplicates.
const percentage = str.substr("Loading Prefab Bundle ".length);
if (seenPercentage[percentage]) return;
const str = data.toString();
if (str.startsWith('Loading Prefab Bundle ')) {
// Rust seems to spam the same percentage, so filter out any duplicates.
const percentage = str.substr('Loading Prefab Bundle '.length);
if (seenPercentage[percentage]) return;
seenPercentage[percentage] = true;
}
seenPercentage[percentage] = true;
}
console.log(str);
console.log(str);
}
var exec = require("child_process").exec;
console.log("Starting Rust...");
var exec = require('child_process').exec;
console.log('Starting Rust...');
var exited = false;
const gameProcess = exec(startupCmd);
gameProcess.stdout.on('data', filter);
gameProcess.stderr.on('data', filter);
gameProcess.on('exit', function (code, signal) {
exited = true;
exited = true;
if (code) {
console.log("Main game process exited with code " + code);
// process.exit(code);
}
if (code) {
console.log('Main game process exited with code ' + code);
// process.exit(code);
}
});
function initialListener(data) {
const command = data.toString().trim();
if (command === 'quit') {
gameProcess.kill('SIGTERM');
} else {
console.log('Unable to run "' + command + '" due to RCON not being connected yet.');
}
const command = data.toString().trim();
if (command === 'quit') {
gameProcess.kill('SIGTERM');
} else {
console.log(
'Unable to run "' +
command +
'" due to RCON not being connected yet.'
);
}
}
process.stdin.resume();
process.stdin.setEncoding("utf8");
process.stdin.setEncoding('utf8');
process.stdin.on('data', initialListener);
process.on('exit', function (code) {
if (exited) return;
if (exited) return;
console.log("Received request to stop the process, stopping the game...");
gameProcess.kill('SIGTERM');
console.log('Received request to stop the process, stopping the game...');
gameProcess.kill('SIGTERM');
});
var waiting = true;
var poll = function () {
function createPacket(command) {
var packet = {
Identifier: -1,
Message: command,
Name: "WebRcon"
};
return JSON.stringify(packet);
}
function createPacket(command) {
var packet = {
Identifier: -1,
Message: command,
Name: 'WebRcon',
};
return JSON.stringify(packet);
}
var serverHostname = process.env.RCON_IP ? process.env.RCON_IP : "localhost";
var serverPort = process.env.RCON_PORT;
var serverPassword = process.env.RCON_PASS;
var WebSocket = require("ws");
var ws = new WebSocket("ws://" + serverHostname + ":" + serverPort + "/" + serverPassword);
var serverHostname = process.env.RCON_IP
? process.env.RCON_IP
: 'localhost';
var serverPort = process.env.RCON_PORT;
var serverPassword = process.env.RCON_PASS;
var WebSocket = require('ws');
var ws = new WebSocket(
'ws://' + serverHostname + ':' + serverPort + '/' + serverPassword
);
ws.on("open", function open() {
console.log("Connected to RCON. Generating the map now. Please wait until the server status switches to \"Running\".");
waiting = false;
ws.on('open', function open() {
console.log(
'Connected to RCON. Generating the map now. Please wait until the server status switches to "Running".'
);
waiting = false;
// Hack to fix broken console output
ws.send(createPacket('status'));
// Hack to fix broken console output
ws.send(createPacket('status'));
process.stdin.removeListener('data', initialListener);
gameProcess.stdout.removeListener('data', filter);
gameProcess.stderr.removeListener('data', filter);
process.stdin.on('data', function (text) {
ws.send(createPacket(text));
});
});
process.stdin.removeListener('data', initialListener);
gameProcess.stdout.removeListener('data', filter);
gameProcess.stderr.removeListener('data', filter);
process.stdin.on('data', function (text) {
ws.send(createPacket(text));
});
});
ws.on("message", function (data, flags) {
try {
var json = JSON.parse(data);
if (json !== undefined) {
if (json.Message !== undefined && json.Message.length > 0) {
console.log(json.Message);
const fs = require("fs");
fs.appendFile("latest.log", "\n" + json.Message, (err) => {
if (err) console.log("Callback error in appendFile:" + err);
});
}
} else {
console.log("Error: Invalid JSON received");
}
} catch (e) {
if (e) {
console.log(e);
}
}
});
ws.on('message', function (data, flags) {
try {
var json = JSON.parse(data);
if (json !== undefined) {
if (json.Message !== undefined && json.Message.length > 0) {
console.log(json.Message);
const fs = require('fs');
fs.appendFile('latest.log', '\n' + json.Message, (err) => {
if (err)
console.log('Callback error in appendFile:' + err);
});
}
} else {
console.log('Error: Invalid JSON received');
}
} catch (e) {
if (e) {
console.log(e);
}
}
});
ws.on("error", function (err) {
waiting = true;
console.log("Waiting for RCON to come up...");
setTimeout(poll, 5000);
});
ws.on('error', function (err) {
waiting = true;
console.log('Waiting for RCON to come up...');
setTimeout(poll, 5000);
});
ws.on("close", function () {
if (!waiting) {
console.log("Connection to server closed.");
ws.on('close', function () {
if (!waiting) {
console.log('Connection to server closed.');
exited = true;
process.exit();
}
});
}
poll();
exited = true;
process.exit();
}
});
};
poll();
+33 -33
View File
@@ -1,33 +1,33 @@
FROM --platform=$TARGETOS/$TARGETARCH debian:bookworm-slim
LABEL author="QuintenQVD" maintainer="[email protected]"
RUN apt update \
&& apt -y upgrade
RUN dpkg --add-architecture i386 \
&& apt update \
&& apt upgrade -y \
&& apt install -y libstdc++6 lib32stdc++6 tar wget curl iproute2 openssl fontconfig dirmngr ca-certificates dnsutils tzdata zip tini \
&& apt install -y libtbb12:i386 libtbb-dev:i386 libicu-dev:i386 \
&& useradd -d /home/container -m container
RUN mkdir -p /run/systemd && echo 'docker' > /run/systemd/container
RUN rm -rf /var/lib/apt/lists/*
# Temp fix for things that still need libssl1.1 32 bit
RUN if [ "$(uname -m)" = "x86_64" ]; then \
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_i386.deb && \
dpkg -i libssl1.1_1.1.0g-2ubuntu4_i386.deb && \
rm libssl1.1_1.1.0g-2ubuntu4_i386.deb; \
fi
USER container
ENV USER=container HOME=/home/container
WORKDIR /home/container
STOPSIGNAL SIGINT
COPY --chown=container:container ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/usr/bin/tini", "-g", "--"]
CMD ["/entrypoint.sh"]
FROM --platform=$TARGETOS/$TARGETARCH debian:bookworm-slim
LABEL author="QuintenQVD" maintainer="[email protected]"
RUN apt update \
&& apt -y upgrade
RUN dpkg --add-architecture i386 \
&& apt update \
&& apt upgrade -y \
&& apt install -y libstdc++6 lib32stdc++6 tar wget curl iproute2 openssl fontconfig dirmngr ca-certificates dnsutils tzdata zip tini \
&& apt install -y libtbb12:i386 libtbb-dev:i386 libicu-dev:i386 \
&& useradd -d /home/container -m container
RUN mkdir -p /run/systemd && echo 'docker' > /run/systemd/container
RUN rm -rf /var/lib/apt/lists/*
# Temp fix for things that still need libssl1.1 32 bit
RUN if [ "$(uname -m)" = "x86_64" ]; then \
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_i386.deb && \
dpkg -i libssl1.1_1.1.0g-2ubuntu4_i386.deb && \
rm libssl1.1_1.1.0g-2ubuntu4_i386.deb; \
fi
USER container
ENV USER=container HOME=/home/container
WORKDIR /home/container
STOPSIGNAL SIGINT
COPY --chown=container:container ./entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/usr/bin/tini", "-g", "--"]
CMD ["/entrypoint.sh"]