The following code is a Rust/WebAssembly-based Snake Game used as a learning tool for the new technology. This code can be build, containerized, and further "distroless" containerized and deployed to Docker, GCP CloudRun, AWS Lambda, etc.
- Ensure that you've properly installed Rust, Cargo, and other standard Rust tools.
- Ensure NPM and NodeJS (I used 20.10 in this project).
- Ensure Rust-specific WebAssembly tools have been installed.
- Ensure Docker Tools are installed
- Clone the repository.
- cd into the /www directory.
- $ npm install
- $ wasm-pack build --target web // This builds the Rust code to WebAssembly found in the ./pkg sub-folder
- $ npm run dev // Runs the Development server
- Clone the repository.
- cd into the /www directory.
- $ npm install
- $ wasm-pack build --target web // This builds the Rust code to WebAssembly found in the ./pkg sub-folder
- $ cd back to /(root) directory
- $ npm run prebuild
- $ npm run build
- $ npm install
- $ npm start
- Point your web browser to http://localhost:3000
- Clone the repository.
- docker build -t snakegame .
- docker tag snakegame snakegame:
Enjoy!