Docker image #205
@ -5,4 +5,6 @@ Docker/
|
||||
Docker.sh
|
||||
BuildRunDocker.js
|
||||
docker_config.json
|
||||
*.log
|
||||
*.log
|
||||
Test
|
||||
test
|
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -1 +1,2 @@
|
||||
* text=LF eol=LF
|
||||
* text=LF eol=LF
|
||||
*.sh text=lf eol=lf
|
17
.github/workflows/PullRequest.yml
vendored
17
.github/workflows/PullRequest.yml
vendored
@ -54,13 +54,6 @@ jobs:
|
||||
Docker-Build:
|
||||
needs: [Node]
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch:
|
||||
- amd64
|
||||
- arm64
|
||||
- arm/v7
|
||||
|
||||
steps:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
@ -73,8 +66,8 @@ jobs:
|
||||
|
||||
- name: Build Docker Image (Multiarch)
|
||||
id: DockerArch
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
target: bdscore
|
||||
tags: coretestarch:latest
|
||||
platforms: linux/${{ matrix.arch }}
|
||||
run: docker build --tag bdscore_pull:latest --file Dockerfile .
|
||||
|
||||
# Run docker image with dev test
|
||||
- name: Run Docker Image (Multiarch)
|
||||
run: docker run --rm -ti bdscore_pull:latest
|
34
.github/workflows/main.yml
vendored
34
.github/workflows/main.yml
vendored
@ -50,9 +50,11 @@ jobs:
|
||||
env:
|
||||
NODE_AUTH_TOKEN: '${{ secrets.NPM_ORG_TOKEN }}'
|
||||
|
||||
docker_core:
|
||||
needs: [npm]
|
||||
DockerImage:
|
||||
needs:
|
||||
- npm
|
||||
runs-on: ubuntu-latest
|
||||
name: Build Docker Image to Bds Core and Bds Base
|
||||
steps:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
@ -70,18 +72,30 @@ jobs:
|
||||
- name: checkout
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Bds Maneger Core Image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
target: bdscore
|
||||
tags: ghcr.io/the-bds-maneger/core:main
|
||||
platforms: ${{ env.DOCKER_ARCH }}
|
||||
- name: Install Node Depedencies
|
||||
run: npm install --no-save -d
|
||||
|
||||
- name: Bds Maneger base Image
|
||||
- name: Get And Export Release Version
|
||||
shell: node
|
||||
run: |
|
||||
const version = require("./package.json").version;
|
||||
const ActionsCore = require("@actions/core");
|
||||
console.log(version);
|
||||
ActionsCore.exportVariable("BdsCoreVersion", version);
|
||||
|
||||
- name: Build Docker image (Bds Maneger Base)
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
target: bdsbase
|
||||
tags: ghcr.io/the-bds-maneger/base:main
|
||||
platforms: ${{ env.DOCKER_ARCH }}
|
||||
|
||||
- name: Build Docker image (Bds Maneger core)
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
target: bdscore
|
||||
cache-from: ghcr.io/the-bds-maneger/base:main
|
||||
tags: ghcr.io/the-bds-maneger/core:main
|
||||
platforms: ${{ env.DOCKER_ARCH }}
|
60
.github/workflows/relelases.yml
vendored
60
.github/workflows/relelases.yml
vendored
@ -31,9 +31,11 @@ jobs:
|
||||
env:
|
||||
NODE_AUTH_TOKEN: '${{ secrets.NPM_ORG_TOKEN }}'
|
||||
|
||||
docker_core:
|
||||
needs: [npm]
|
||||
DockerImage:
|
||||
needs:
|
||||
- npm
|
||||
runs-on: ubuntu-latest
|
||||
name: Build Docker Image to Bds Core and Bds Base
|
||||
steps:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
@ -51,40 +53,34 @@ jobs:
|
||||
- name: checkout
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
target: bdscore
|
||||
tags: ghcr.io/the-bds-maneger/core:latest
|
||||
platforms: ${{ env.DOCKER_ARCH }}
|
||||
- name: Install Node Depedencies
|
||||
run: npm install --no-save -d
|
||||
|
||||
docker_base:
|
||||
needs: [npm]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Get And Export Release Version
|
||||
shell: node
|
||||
run: |
|
||||
const version = require("./package.json").version;
|
||||
const ActionsCore = require("@actions/core");
|
||||
console.log(version);
|
||||
ActionsCore.exportVariable("BdsCoreVersion", version);
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: checkout
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
- name: Build Docker image (Bds Maneger Base)
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
target: bdsbase
|
||||
tags: ghcr.io/the-bds-maneger/base:latest
|
||||
tags: |
|
||||
ghcr.io/the-bds-maneger/base:latest
|
||||
ghcr.io/the-bds-maneger/base:${{ env.BdsCoreVersion }}
|
||||
platforms: ${{ env.DOCKER_ARCH }}
|
||||
|
||||
- name: Build Docker image (Bds Maneger core)
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
target: bdscore
|
||||
cache-from: ghcr.io/the-bds-maneger/base:latest
|
||||
tags: |
|
||||
ghcr.io/the-bds-maneger/core:latest
|
||||
ghcr.io/the-bds-maneger/core:${{ env.BdsCoreVersion }}
|
||||
platforms: ${{ env.DOCKER_ARCH }}
|
@ -1,52 +0,0 @@
|
||||
name: BdsCore
|
||||
file: Dockerfile
|
||||
tag: bdsmanegercore:dev
|
||||
target: bdscore
|
||||
buildx:
|
||||
enable: false
|
||||
platform: linux/amd64,linux/arm/v7,linux/arm64
|
||||
|
||||
# Docker Run envs
|
||||
env:
|
||||
- name: DESCRIPTION
|
||||
value: Docker Test
|
||||
|
||||
- name: WORLD_NAME
|
||||
value: Docker Run Test
|
||||
|
||||
- name: GAMEMODE
|
||||
value: survival
|
||||
|
||||
- name: DIFFICULTY
|
||||
value: normal
|
||||
|
||||
- name: XBOX_ACCOUNT
|
||||
value: false
|
||||
|
||||
- name: PLAYERS
|
||||
value: 5
|
||||
|
||||
- name: BDS_VERSION
|
||||
value: latest
|
||||
|
||||
- name: SERVER
|
||||
value: bedrock
|
||||
|
||||
# Docker Run Mount
|
||||
mount: []
|
||||
|
||||
# Docker Run Ports
|
||||
ports:
|
||||
- in: 19132
|
||||
out: 19132
|
||||
protocoll: udp
|
||||
- in: 1932
|
||||
out: 1932
|
||||
protocoll: tcp
|
||||
|
||||
# More options
|
||||
options:
|
||||
build: []
|
||||
run:
|
||||
- "-v $(pwd)/Test:/root/bds_core"
|
||||
runArgv: []
|
@ -23,7 +23,7 @@ function StartServer(){
|
||||
console.log("The entire log can be accessed via the api and/or the docker log");
|
||||
const ServerStarted = BdsCore.start();
|
||||
ServerStarted.log(a => process.stdout.write(a));
|
||||
ServerStarted.exit(process.exit);
|
||||
ServerStarted.exit(code => process.exit(code));
|
||||
BdsCore.api();
|
||||
ShowToken();
|
||||
if (process.env.UPDATE_SERVER === "true") {
|
||||
@ -56,19 +56,19 @@ function StartServer(){
|
||||
}
|
||||
}
|
||||
|
||||
// Check Installed Server
|
||||
const AllVersions = BdsCore.BdsSettigs.GetJsonConfig().server.versions;
|
||||
if (Object.getOwnPropertyNames(AllVersions).filter(platform => AllVersions[platform]).length >= 1) {
|
||||
if (process.env.UPDATE_SERVER === "true") {
|
||||
BdsCore.download(true, true, (err) => {
|
||||
if (err) {
|
||||
async function RenderCLI(){
|
||||
// Check Installed Server
|
||||
const AllVersions = BdsCore.BdsSettigs.GetJsonConfig().server.versions;
|
||||
if (Object.getOwnPropertyNames(AllVersions).filter(platform => AllVersions[platform]).length >= 1) {
|
||||
if (process.env.UPDATE_SERVER === "true") {
|
||||
try {
|
||||
await BdsCore.download(true, true);
|
||||
StartServer();
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
}
|
||||
StartServer();
|
||||
});
|
||||
} else {
|
||||
(async () => {
|
||||
} else {
|
||||
// Check for Update
|
||||
if (AllVersions[GetPlatform()] === Object.getOwnPropertyNames((await (await fetch(BdsInfo.Fetchs.servers)).json())[GetPlatform()])[0]) {
|
||||
console.log("The entire log can be accessed via the api and/or the docker log");
|
||||
@ -85,34 +85,35 @@ if (Object.getOwnPropertyNames(AllVersions).filter(platform => AllVersions[platf
|
||||
StartServer();
|
||||
});
|
||||
}
|
||||
})();
|
||||
}
|
||||
} else {
|
||||
console.log("Server is not installed, starting server implementation");
|
||||
// Import ENV to Settings Server
|
||||
const { DESCRIPTION, WORLD_NAME, GAMEMODE, DIFFICULTY, ACCOUNT, PLAYERS, SERVER, ENABLE_COMMANDS } = process.env;
|
||||
// Update Platform
|
||||
BdsCore.change_platform(SERVER || "bedrock");
|
||||
BdsCore.download(true, true, (err) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
} else {
|
||||
console.log("Server is not installed, starting server implementation");
|
||||
// Import ENV to Settings Server
|
||||
const { DESCRIPTION, WORLD_NAME, GAMEMODE, DIFFICULTY, ACCOUNT, PLAYERS, SERVER, ENABLE_COMMANDS } = process.env;
|
||||
// Update Platform
|
||||
BdsCore.change_platform(SERVER || "bedrock");
|
||||
try {
|
||||
await BdsCore.download(true, true);
|
||||
// Create JSON Config
|
||||
const ServerConfig = {
|
||||
world: WORLD_NAME,
|
||||
description: DESCRIPTION,
|
||||
gamemode: GAMEMODE,
|
||||
difficulty: DIFFICULTY,
|
||||
players: parseInt(PLAYERS),
|
||||
commands: ENABLE_COMMANDS === "true",
|
||||
account: ACCOUNT === "true",
|
||||
whitelist: false,
|
||||
port: 19132,
|
||||
portv6: 19133,
|
||||
}
|
||||
BdsCore.bds_maneger_token_register(["admin"]);
|
||||
BdsCore.set_config(ServerConfig);
|
||||
StartServer();
|
||||
} catch (err) {
|
||||
console.log(`${err}`);
|
||||
process.exit(1);
|
||||
}
|
||||
// Create JSON Config
|
||||
const ServerConfig = {
|
||||
world: WORLD_NAME,
|
||||
description: DESCRIPTION,
|
||||
gamemode: GAMEMODE,
|
||||
difficulty: DIFFICULTY,
|
||||
players: parseInt(PLAYERS),
|
||||
commands: ENABLE_COMMANDS === "true",
|
||||
account: ACCOUNT === "true",
|
||||
whitelist: false,
|
||||
port: 19132,
|
||||
portv6: 19133,
|
||||
}
|
||||
BdsCore.bds_maneger_token_register(["admin"]);
|
||||
BdsCore.set_config(ServerConfig);
|
||||
StartServer();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
RenderCLI();
|
21
docker-compose.yaml
Normal file
21
docker-compose.yaml
Normal file
@ -0,0 +1,21 @@
|
||||
version: "2.1"
|
||||
services:
|
||||
bdscore:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: bds_maneger_core
|
||||
environment:
|
||||
DESCRIPTION: "Docker Test"
|
||||
WORLD_NAME: "Docker Run Test"
|
||||
GAMEMODE: "survival"
|
||||
DIFFICULTY: "normal"
|
||||
XBOX_ACCOUNT: "false"
|
||||
PLAYERS: "5"
|
||||
BDS_VERSION: "latest"
|
||||
SERVER: "bedrock"
|
||||
ports:
|
||||
- 1932:1932/tcp
|
||||
- 19132:19132/udp
|
||||
volumes:
|
||||
- ./Test:/root/bds_core
|
37
package-lock.json
generated
37
package-lock.json
generated
@ -46,7 +46,7 @@
|
||||
"bds_telegram": "bin/telegram_bot.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"docker-run_build": "*",
|
||||
"@actions/core": "^1.5.0",
|
||||
"eslint": "^7.19.0",
|
||||
"nodemon": "^2.0.12",
|
||||
"os-tmpdir": "^2.0.0"
|
||||
@ -55,6 +55,12 @@
|
||||
"node": ">=15.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/core": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.5.0.tgz",
|
||||
"integrity": "sha512-eDOLH1Nq9zh+PJlYLqEMkS/jLQxhksPNmUGNBHfa4G+tQmnIhzpctxmchETtVGyBOvXgOVVpYuE40+eS4cUnwQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@azure/abort-controller": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-1.0.4.tgz",
|
||||
@ -1419,19 +1425,6 @@
|
||||
"node": ">=4.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/docker-run_build": {
|
||||
"version": "12.962.522",
|
||||
"resolved": "https://registry.npmjs.org/docker-run_build/-/docker-run_build-12.962.522.tgz",
|
||||
"integrity": "sha512-962cx7CZlVVqlKoF9ajnSsIlN8RKYWKWutuDSFTXR+81D/d+oprc+fTp0sFz+S2dTgufcsiVRZ+xiO4iZ0OmTw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"js-yaml": "^4.1.0",
|
||||
"minimist": "^1.2.5"
|
||||
},
|
||||
"bin": {
|
||||
"docker-run_build": "bin/cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/doctrine": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
|
||||
@ -5721,6 +5714,12 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.5.0.tgz",
|
||||
"integrity": "sha512-eDOLH1Nq9zh+PJlYLqEMkS/jLQxhksPNmUGNBHfa4G+tQmnIhzpctxmchETtVGyBOvXgOVVpYuE40+eS4cUnwQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@azure/abort-controller": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-1.0.4.tgz",
|
||||
@ -6781,16 +6780,6 @@
|
||||
"streamsearch": "0.1.2"
|
||||
}
|
||||
},
|
||||
"docker-run_build": {
|
||||
"version": "12.962.522",
|
||||
"resolved": "https://registry.npmjs.org/docker-run_build/-/docker-run_build-12.962.522.tgz",
|
||||
"integrity": "sha512-962cx7CZlVVqlKoF9ajnSsIlN8RKYWKWutuDSFTXR+81D/d+oprc+fTp0sFz+S2dTgufcsiVRZ+xiO4iZ0OmTw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"js-yaml": "^4.1.0",
|
||||
"minimist": "^1.2.5"
|
||||
}
|
||||
},
|
||||
"doctrine": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
|
||||
|
@ -16,7 +16,7 @@
|
||||
"eslint": "eslint --debug .",
|
||||
"eslint:fix": "eslint --debug --fix .",
|
||||
"nexe": "echo Nexe Removed from Bds Maneger Core && exit 1",
|
||||
"Docker": "node .Build/DockerImage.js",
|
||||
"Docker": "docker-compose build && docker-compose up",
|
||||
"remove_dev_versions": "node .Build/RemoveVersions.js"
|
||||
},
|
||||
"bin": {
|
||||
@ -80,7 +80,7 @@
|
||||
"telegraf": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"docker-run_build": "*",
|
||||
"@actions/core": "^1.5.0",
|
||||
"eslint": "^7.19.0",
|
||||
"nodemon": "^2.0.12",
|
||||
"os-tmpdir": "^2.0.0"
|
||||
|
@ -37,9 +37,15 @@ app.get("/info", ({res}) => {
|
||||
System: process.platform,
|
||||
Arch: BdsCore.arch,
|
||||
Kernel: BdsSystemInfo.GetKernel(),
|
||||
Cpu_Model: os.cpus()[0].model || null,
|
||||
Cpu_Model: (os.cpus()[0] || {}).model || null,
|
||||
IsDocker: false,
|
||||
IsNpx: false,
|
||||
IsCLI: false,
|
||||
}
|
||||
}
|
||||
if (process.env.BDS_DOCKER_IMAGE) Info.host.IsDocker = true;
|
||||
if (process.env.npm_lifecycle_event === "npx") Info.host.IsNpx = true;
|
||||
if (process.env.IS_BDS_CLI) Info.host.IsCLI = true;
|
||||
res.json(Info);
|
||||
} catch (error) {
|
||||
res.status(500).json({
|
||||
|
Reference in New Issue
Block a user