KhronosGroup / KTX-Software

KTX (Khronos Texture) Library and Tools
Other
881 stars 231 forks source link

Recommended Docker image? #351

Closed emackey closed 3 years ago

emackey commented 3 years ago

I'd like to build the Emscripten version in a Docker image, if possible. I tried this:

PS> docker pull emscripten/emsdk
(Open Docker shell)
# cd KTX-Software
# emcmake cmake -Bbuild-web .

But Emscripten's Docker image has an out-of-date cmake install:

CMake 3.15 or higher is required. You are running version 3.13.4

Is there a better Docker image I could start from, to build emscripten?

MarkCallow commented 3 years ago

We have not investigated Docker images since we set up our CI. At that time we found nothing more recent so our CI resorts to installing a more up-to-date CMake in the Docker image. Here's the relevant part of the script.

# Temporary solution: Update CMake. Can be dropped once the Ubuntu version in the docker
# container is updated.
echo "Update CMake for Web"
docker exec -it emscripten sh -c "apt-get update"
docker exec -it emscripten sh -c "apt-get -qq install -y --no-install-recommends apt-transport-https ca-certificates gnupg software-properties-common wget"
docker exec -it emscripten sh -c "wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null"
docker exec -it emscripten sh -c "apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'"
docker exec -it emscripten sh -c "apt-get update"
docker exec -it emscripten sh -c "apt-get -qq install -y --no-install-recommends cmake"

If you find a more up-to-date Docker image, please let us know. This is becoming more urgent as we will likely have to update the minimum CMake to 3.19 for macOS builds, at least.

@atteneder, any comment?

emackey commented 3 years ago

FYI, I learned recently that Khronos has an official Docker container and image collection:

Over in the glTF repo, @oddhack set up CI to use vulkan-docs-base to build the AsciiDoctor version of the spec that's under development.

Perhaps Khronos could build an image based on emscripten SDK with a newer cmake applied?

oddhack commented 3 years ago

Perhaps Khronos could build an image based on emscripten SDK with a newer cmake applied?

It is straightforward to do that if you want to. Create a new Dockerfile in a branch of the DockerContainers repo, use the build-one script to build the image locally, test it, propose an MR. Ryan or I can then push the image to dockerhub. Unfortunately we're on a paid plan so can't just give everyone in Khronos developer permissions on the khronosgroup dockerhub (though you can host it in your own personal dockerhub space as an interim step).

As there's increasing usage of Docker we might want to refactor the existing dockerfiles to have a common base with ruby + generally useful asciidoctor toolchain components, then layer repo-specific images on that - we could discuss that in the DockerContainers repo, though.

atteneder commented 3 years ago

Sorry for the late response.

Locally I never built using docker, nor do I have much experience with creating docker files. I'd appreciate if an experienced person could do this.

MarkCallow commented 3 years ago

There is an official emsdk docker release: https://hub.docker.com/u/emscripten/emsdk. It appears not possible to access without signing up for docker. (Presumably the same is true for the Khronos docker images.) I need to investigate the logistics of dealing with that in the context of running CI for Khronos software before I commit to signing up so I have not looked at the image yet to see what it contains.

oddhack commented 3 years ago

There is an official emsdk docker release: https://hub.docker.com/u/emscripten/emsdk. It appears not possible to access without signing up for docker. (Presumably the same is true for the Khronos docker images.)

Not sure what you mean by 'access', but you shouldn't need a Dockerhub account to use this image either locally or in CI system of choice. Just specify container 'emscripten/emsdk:latest' at the appropriate place in your local docker invocation, or CI script.

MarkCallow commented 3 years ago

Not sure what you mean by 'access',

I entered the link in my browser hoping to find out what is in the docker image, e.g. does it have cmake and cpack and, if so, what version. I was greeted by a mostly blank page asking me to sign-in or sign-up for docker.com.

oddhack commented 3 years ago

I entered the link in my browser hoping to find out what is in the docker image, e.g. does it have cmake and cpack and, if so, what version. I was greeted by a mostly blank page asking me to sign-in or sign-up for docker.com.

Try https://hub.docker.com/u/emscripten/ and click through to the image you're interested in. Works fine in a guest browser window not logged into dockerhub for me.

MarkCallow commented 3 years ago

Thanks Jon. The link to the emsdk image from https://hub.docker.com/u/emscripten/ is to https://hub.docker.com/r/emscripten/emsdk which indeed shows details of the image. Note the "r" instead of the "u" that is given in the emsdk README.md.

MarkCallow commented 3 years ago

I orchestrated an update to the official Docker Emscripten image which was uploaded to Docker recently as part of the latest Emscripten release, 2.0.16. See emsdk PR #747. I will shortly be creating a PR in this repo with a script for building the wasm modules using this official image. Once that is merged you'll be able to build the wasm modules by

$ cd <project root>
$ ci_scripts/build_wasm_docker.sh

The script puts the results in the directory build/wasm.