Skip to content

feat: Adds a Docker Build for the Web Client#697

Merged
reeesespuffs merged 7 commits intostoatchat:mainfrom
luthes:docker-build
Feb 19, 2026
Merged

feat: Adds a Docker Build for the Web Client#697
reeesespuffs merged 7 commits intostoatchat:mainfrom
luthes:docker-build

Conversation

@luthes
Copy link
Contributor

@luthes luthes commented Feb 13, 2026

This adds a multi-stage docker build for the web client. This was missing in the self-hosted compose (or at least was using the old UI).

  • Multi stage Dockerfile - Builds a nice small alpine image with all the static output
  • inject.js - Vite bakes env vars at build time, so I had to replace these (this also helps with multi-env without having a ton of different builds. One image, any environment).
  • Github Actions: CI for the docker builds. I just noticed there's no arm64 in the docker builds and I saw other builds with it, I can add it if needed.

Just a quick bit on the inject.js script, that runs at container startup and copies the built dist/ to dist_injected/, does a find and replace of the placeholder strings with the actual env vars, and serves the result, but the original dist isn't touched, so containers restart cleanly.

...Or do they. Now that I write that, I might have over-engineered that bit, and it only needs to do the replace, any container/pod restarts would just restore the original dist/. Let me know which direction you'd want to go with that, and I can modify it. The replace needs to happen regardless. Maybe it's useful to keep the original around 🤷

You can test it though:

  • docker build -t for-web .
  • docker run -e VITE_API_URL=https://api.stoat.chat -e VITE_WS_URL=wss://ws.stoat.chat -p 5000:5000 for-web
  • Verify env vars are injected in served JS

Signed-off-by: Steven Luther <steven@lutherlabs.com>
Signed-off-by: Steven Luther <steven@lutherlabs.com>
Signed-off-by: Steven Luther <steven@lutherlabs.com>
Signed-off-by: Steven Luther <steven@lutherlabs.com>
@luthes luthes changed the title Adds a Docker Build for the Web Client ci: Adds a Docker Build for the Web Client Feb 13, 2026
@luthes
Copy link
Contributor Author

luthes commented Feb 13, 2026

I was just reading over the other Docker PR. I think the dist_injected directory actually helps (solves?) the security issue brought up in this comment, and the one below it. Or at least is an implementation of the tmpfs that was talked about there.

I am not sure that either Nginx + SSI or the env inject approach are any more secure than the other. If an attacker gets access to the file system, both methods will have a writable filesystem they can access. I'm not a security expert, but it doesnt' seem much different if they get container access in one vs. the other.

Signed-off-by: Steven Luther <steven@lutherlabs.com>
@reeesespuffs reeesespuffs changed the title ci: Adds a Docker Build for the Web Client feat: Adds a Docker Build for the Web Client Feb 19, 2026
@reeesespuffs reeesespuffs merged commit 6c5970f into stoatchat:main Feb 19, 2026
8 of 10 checks passed
Jade3375 pushed a commit that referenced this pull request Feb 26, 2026
* feat: add runtime env injection script and server package

Signed-off-by: Steven Luther <steven@lutherlabs.com>

* fix: remove revolt env vars

Signed-off-by: Steven Luther <steven@lutherlabs.com>

* ci: add GitHub Actions workflow for Docker image build and push

Signed-off-by: Steven Luther <steven@lutherlabs.com>

* improvement: rewrite to use native node packages

Signed-off-by: Steven Luther <steven@lutherlabs.com>

* improvement: bump Docker base image from Node 22 to Node 24 LTS

Signed-off-by: Steven Luther <steven@lutherlabs.com>

---------

Signed-off-by: Steven Luther <steven@lutherlabs.com>
Signed-off-by: Jade3375 <floodlockgames9@gmail.com>
Jade3375 pushed a commit that referenced this pull request Feb 26, 2026
* feat: add runtime env injection script and server package

Signed-off-by: Steven Luther <steven@lutherlabs.com>

* fix: remove revolt env vars

Signed-off-by: Steven Luther <steven@lutherlabs.com>

* ci: add GitHub Actions workflow for Docker image build and push

Signed-off-by: Steven Luther <steven@lutherlabs.com>

* improvement: rewrite to use native node packages

Signed-off-by: Steven Luther <steven@lutherlabs.com>

* improvement: bump Docker base image from Node 22 to Node 24 LTS

Signed-off-by: Steven Luther <steven@lutherlabs.com>

---------

Signed-off-by: Steven Luther <steven@lutherlabs.com>
Signed-off-by: Jade3375 <floodlockgames9@gmail.com>
Pecacheu pushed a commit to Pecacheu/for-web that referenced this pull request Mar 2, 2026
* feat: add runtime env injection script and server package

Signed-off-by: Steven Luther <steven@lutherlabs.com>

* fix: remove revolt env vars

Signed-off-by: Steven Luther <steven@lutherlabs.com>

* ci: add GitHub Actions workflow for Docker image build and push

Signed-off-by: Steven Luther <steven@lutherlabs.com>

* improvement: rewrite to use native node packages

Signed-off-by: Steven Luther <steven@lutherlabs.com>

* improvement: bump Docker base image from Node 22 to Node 24 LTS

Signed-off-by: Steven Luther <steven@lutherlabs.com>

---------

Signed-off-by: Steven Luther <steven@lutherlabs.com>
amycatgirl pushed a commit to amycatgirl/stoat-frontend that referenced this pull request Mar 17, 2026
* feat: add runtime env injection script and server package

Signed-off-by: Steven Luther <steven@lutherlabs.com>

* fix: remove revolt env vars

Signed-off-by: Steven Luther <steven@lutherlabs.com>

* ci: add GitHub Actions workflow for Docker image build and push

Signed-off-by: Steven Luther <steven@lutherlabs.com>

* improvement: rewrite to use native node packages

Signed-off-by: Steven Luther <steven@lutherlabs.com>

* improvement: bump Docker base image from Node 22 to Node 24 LTS

Signed-off-by: Steven Luther <steven@lutherlabs.com>

---------

Signed-off-by: Steven Luther <steven@lutherlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants