As a continuation from: https://github.com/emscripten-core/emscripten/issues/8742 This PR provides adopted Dockerfile from https://github.com/trzecieu/emscripten-docker/blob/master/docker/trzeci/emscripten-fastcomp/Dockerfile which supports builds: * fastcomp * upstream Features: * An image can be build with fastcomp and upstream version of Emscripten SDK * It applies some extra size optimizations (that might be removed in sake of clarity / stability) * It creates conventional `1000:1000` user `emscripten` * It creates extra entrypoint that mitigates running as non-root user (Some context: https://trzeci.eu/fixing-permission-of-files-created-from-docker/) * It has simple-stupid tests performed during building
28 lines
868 B
Bash
Executable File
28 lines
868 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# In case when mapped user id by `docker run -u` is not created inside docker image
|
|
# The `$HOME` variable points to `/` - which prevents any tool to write to, as it requires root access
|
|
# In such case we set `$HOME` to `/tmp` as it should r/w for everyone
|
|
|
|
if [ "$HOME" = "/" ] ; then
|
|
export HOME=/tmp
|
|
fi
|
|
|
|
# In case of running as root, use `umask` to reduce problem of file permission on host
|
|
if [ "$(id -g)" = "0" ] && [ "$(id -u)" = "0" ] ;
|
|
then
|
|
umask 0000
|
|
fi
|
|
|
|
# Export this image specific Environment variables
|
|
# Those variables are important to use dedicated folder for all cache and predefined config file
|
|
export EM_CONFIG=/emsdk/.emscripten
|
|
export EM_CACHE=/emsdk/.data/cache
|
|
export EM_PORTS=/emsdk/.data/ports
|
|
|
|
# Activate Emscripten SDK
|
|
. ${EMSDK}/emsdk_set_env.sh
|
|
|
|
# Evaluate a command that's coming after `docker run` / `docker exec`
|
|
"$@"
|