build: (all branches) Add Docker build instructions#104
Open
richardcoucoules wants to merge 3 commits into
Open
build: (all branches) Add Docker build instructions#104richardcoucoules wants to merge 3 commits into
richardcoucoules wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Dockerfile which constructs an image from the contents of the checked out branch. The intention is to make cross-platform self-hosting and dependency management much easier and sandboxes the runtime such that it's not on a host's baremetal with access to their filesystem/resources. This differs from the Server repo in that it is intended to be a non-interactive, single-command deployment.
The image is constructed by transpiling the TS code to JS with
typescript tscand running the output directly with node (as opposed to usingtsx, which the existing dev scripts do), which should cut down on dependency size and processor load while running. To this end, two newnpmscripts were added:compile, which transpiles the TS to JS files andstart:compiledwhich starts a node server with an entrypoint at the transpiledapp.jsfile.I encountered and addressed two transpilation issues in the existing repo while doing this:
src/server/login/index.d.tsis defined as a typescript declaration file but contains some logic (i.e., theisPlayerLoginResponseandisPlayerLogoutResponsefunctions). Declaration files are ignored by the transpiler, leading to module not found errors, so this file was changed to a raw TS file to more accurately convey the contents of the file.new URL('*.ts')invocations don't survive the transpilation step, as the*.tstarget is not changed from the TS -> JS representation of the file and the transpiled output doesn't have access to the original TS files (nor could it parse them if it did). The suggestion in this PR is to change all of those to.jstargets, which should work for both the JIT transpilation fromtsxand the pre-transpilation fromtsc.productioncondition was added topackage.jsonimportsdirective specifying that aliased import paths should resolve to./out/*. This fixes bugs in aliased imports resolution which expect files relative to the root directory.These seem innocuous enough to include in the same PR, but I'm somewhat wary of the second change and would appreciate a sanity check from anyone who's well versed in what these Worker/URLs are doing and what appropriate testing would be in this domain.
Testing
This image is currently being served at https://rs.coucoul.es/rs2.cgi with localhost-based login, friend, and logger servers. A test user is created with credentials
lostcitytest!test123!for demonstration.In addition, ran basic e2e regression tests
npm startstill works locally, bringing up the server and a functioning webclientnpm startThe container can be built and tested by doing
where
<local reference to content directory>is the file path to the local copy of the Content repo; based on the description of that repo, the contents are Jagex IP and so should probably not be packaged in this container.More customization can be done by mounting a
world.jsonfile to the container (add-v <world.json location>:/opt/server/engine/data/config/world.jsonto thedocker runcommand above). This was tested briefly to confirm that the friend, logger, and login servers successfully spun up (see attached logs below), but I did not go through a full registration/sign in workflow.~/code/lost-city/test ❯ docker run -it -v ./lost-city/content:/opt/server/content -v ./world.json:/opt/server/engine/data/config/world.json -p 8888:80 --rm lostcity-engine 6/10/2026 8:12:55 PM INFO Starting world 6/10/2026 8:13:00 PM DEBUG Loading game map 6/10/2026 8:13:02 PM DEBUG 7321/16383 static NPCs added 6/10/2026 8:13:02 PM INFO World ready: Visit http://localhost/rs2.cgi 6/10/2026 8:13:00 PM INFO Login server listening on port 43500 6/10/2026 8:12:58 PM INFO Friend server listening on port 45099 6/10/2026 8:12:58 PM INFO Logger server listening on port 43501