Provide out-of-the-box simple web developed environment for raylib developers
Of course the Docker Engine , following the offical installation.
May be podman can be considered too
First let me show the directory structure.
.
├── build.sh
├── Dockerfile
├── game
├── README.md
└── run-env.sh
file/dir | remark |
---|---|
Dockerfile | how to build the raylib web env |
build.sh | build the raylib web env |
run-env.sh | run the raylib web env |
README.md | a markdown file |
game | a raylib game template |
Running the command below to build the docker images.
./build.sh
While building successfully, you can run the command:
./run-env.sh
If you want to install something packages in runing container, please remove flag
--rm
in run-env.sh
After that your working directory will be /home/user/game
which the host directory game
has been mounted.
The common way to build with cmake.
mkdir build && cd build
emcmake will define -DCMAKE_TOOLCHAIN_FILE
-DCMAKE_CROSSCOMPILING_EMULATOR
for cmake. Always adding emcmake before cmake command.
emcmake cmake ..
The cmake will generate Makefile, so just make it
make
You will finally find the compiled file index.html in web directory.
The directory has been mounted, so be free to running this command in docker or your host machine.
Running the command below in web directory.
python3 -m http.server
open your browser and visit http://localhost:8000
- Specify raylib version when building docker image
- Specify emsdk version when building docker image
- Minimize the image size