From 574cdfc5319a3bd9213aaa3d4577f65e836f354a Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Sat, 9 Nov 2024 11:19:40 +0300 Subject: [PATCH] docs: add deploy to Koyeb button --- Dockerfile | 2 +- README.MD | 6 ++++-- scripts/dockerPrepare.mjs | 5 +++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2e43ad8aa..a5f6ac062 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ RUN pnpm i # ENTRYPOINT ["pnpm", "run", "run-all"] # only for prod -RUN pnpm run build +RUN GITHUB_REPOSITORY=zardoy/minecraft-web-client pnpm run build # ---- Run Stage ---- FROM node:18-alpine diff --git a/README.MD b/README.MD index 6756d3505..77f680323 100644 --- a/README.MD +++ b/README.MD @@ -38,11 +38,13 @@ Whatever offline mode you used (zip, folder, just single player), you can always ![docs-assets/singleplayer-future-city-1-10-2.jpg](./docs-assets/singleplayer-future-city-1-10-2.jpg) -### Servers +### Servers & Proxy You can play almost on any Java server, vanilla servers are fully supported. See the [Mineflayer](https://github.com/PrismarineJS/mineflayer) repo for the list of supported versions (should support majority of versions). -There is a builtin proxy, but you can also host your one! Just clone the repo, run `pnpm i` (following CONTRIBUTING.MD) and run `pnpm prod-start`, then you can specify `http://localhost:8080` in the proxy field. +There is a builtin proxy, but you can also host your one! Just clone the repo, run `pnpm i` (following CONTRIBUTING.MD) and run `pnpm prod-start`, then you can specify `http://localhost:8080` in the proxy field. Or you can deploy it to the cloud service: + +[![Deploy to Koyeb](https://www.koyeb.com/static/images/deploy/button.svg)](https://app.koyeb.com/deploy?name=minecraft-web-client&type=git&repository=zardoy%2Fminecraft-web-client&branch=next&builder=dockerfile&env%5B%5D=&ports=8080%3Bhttp%3B%2F) Proxy servers are used to connect to Minecraft servers which use TCP protocol. When you connect connect to a server with a proxy, websocket connection is created between you (browser client) and the proxy server located in Europe, then the proxy connects to the Minecraft server and sends the data to the client (you) without any packet deserialization to avoid any additional delays. That said all the Minecraft protocol packets are processed by the client, right in your browser. diff --git a/scripts/dockerPrepare.mjs b/scripts/dockerPrepare.mjs index fd3680b4d..ff009168e 100644 --- a/scripts/dockerPrepare.mjs +++ b/scripts/dockerPrepare.mjs @@ -2,6 +2,11 @@ import fs from 'fs' import path from 'path' import { fileURLToPath } from 'url' +import { execSync } from 'child_process' + +// write release tag +const commitShort = execSync('git rev-parse --short HEAD').toString().trim() +fs.writeFileSync('./assets/release.json', JSON.stringify({ latestTag: `${commitShort} (docker)` }), 'utf8') const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8')) delete packageJson.optionalDependencies