This is a playground for Tauri app development. You can leverage the hot reloading feature of Tauri(or rather Vite?) inside the Docker container.
At the moment, Neither hot reloading nor even reloading work properly on the VNC display in the container, and the cause is still under investigation.
→ On Windows, using WSL2(Windows Subsystem for Linux 2) resolved the problem and also saved a large amount of time at building containers and compiling Rust backend.
Keywords:
- Windows, WSL2, Linux, VS Code, Dev Containers, Docker, Tauri, Vite, Rust, React, TypeScript, PostgreSQL
-
You have installed:
on your local machine.
- You have added the following VS Code extensions:
- Dev Containers (Remote Development for Windows users instead)
- It's unclear whether this works properly on Mac OS
- If you use Windows PC, then use WSL2, otherwise hot reloading cannot fire, which leads to tremendous inconvenience
- Run your Docker Desktop
- Create the docker image and run the container
- Select the menu "Dev Containers: Reopen in Container".
- You could also select "Reopen in Container" in a pop-up toaster that appears at the bottom right on VS Code when opening
- Create your Tauri app template * Skip this if you use the existing tauri-example or git clone other repos
- Execute the command:
yarn create tauri-app
- Follow the prompts and choose your preferences
- In tauri-example, they are the followings:
- Project name: tauri-example
- Choose which language to use for your frontend: TypeScript / JavaScript
- Choose your package manager: yarn
- Choose your UI template: React
- Choose your UI flavor: TypeScript
- In tauri-example, they are the followings:
- Move to the project directory
cd ${--Project name here--}
- Add dependencies in package.json to the project
yarn
- Open a dev browser
- Execute the command: * It could take some minutes the first time because of having to building backend. Later, it would be much faster by using cache.
yarn tauri dev
- Open localhost:6080 (the port number is defined in devcontainer.json)
- Connect to noVNC with the password set in devcontainer.json ("vscode" in this example)
- Now all taken care of! It automatically detects changes on both frontend and backend and reflects them on the browser by hot reloading.
Execute the command below
psql -d db -U postgres -h localhost
and then,