Closed jerkstorecaller closed 1 year ago
Yeah you will need node to run the build commands, but you shouldn't need tuari. you don't actually need it to self-host, that's just for the desktop app, so if the dependencies mandate you install that as well it's a mistake.
The gist is, in a node docker container run the ui:build
. This will skip all the tuari desktop stuff: https://github.com/iansinnott/prompta/blob/master/package.json#L11
The you will have all the static built files for the site. Then you can run npm run preview
to start the web app.
The whole thing gets built to a static site, so you won't need vite or any of that stuff to run the site if you want a simpler setup. However, there's no command to server the static assets so you'd need to configure that however you like in the docker container.
Thanks Ian. I didn't know npm was installing vite and tauri executables and they could be invoked using "npx
The only change I ended up doing is making the startup command "npx run preview --host" because otherwise it only listens on localhost which is not reachable from outside the Prompta container.
So the final Dockerfile is:
FROM node:latest
WORKDIR /root
RUN git clone https://github.com/iansinnott/prompta \
&& cd prompta \
&& npm install \
&& npm run ui:build
WORKDIR /root/prompta
CMD ["npx", "vite", "preview", "--host"]
And an alternative docker-compose.yml from the OP which serves the above image publically on port 4173 (the one in the OP uses "expose"i nstead of "ports" which only works when you have a webserver in a different container reverse proxying to Prompta):
version: '3.8'
services:
app:
container_name: prompta
ports:
- '4173:4173'
build:
context: .
Great, thanks @jerkstorecaller !
I wanted to self-host Prompta in Docker on my personal server, Docker being the most common way people who self-host share "instant recipes" for apps.
Node apps are usually super easy to dockerize, but this one requires additional dependencies (tauri, vite) that I've never heard of, and for various reasons it fails and I'm not sure why. I figured the dev would be the best-placed person. Tauri isn't even required to self-host on a webserver, so just a little cleanup of the build system should do it.
I got this far. To test, create a Dockerfile and a docker-compose.yml file in the same directory then run "docker compose up".
Dockerfile
docker-compose.yml
RESULT for "docker compose up":
If you can give me working build commands I'll send a pull request for Dockerfile + compose file.