Public Repository

Last pushed: 5 days ago
Short Description
A complete container what allows to compile Emscripten and WebAssembly project
Full Description

Docker: emscripten

A complete container what is required to compile C++ code with Emscripten. The goal was to provide a container what includes the most popular development packages and it's also easy to extend.
Since tag 1.37.16 this container bases on https://hub.docker.com/r/trzeci/emscripten-slim/

Structure

Each tag was build from Dockerfile

  • Base system: trzeci/emscripten-slim:
  • Installed packages:
    • python: 2.7
    • nodejs: 4.1.1_64bit (from EMSDK)
  • Extra packages:
    • cmake: 3.6.3
    • ant : 1.9.4-3
    • build-essential : 11.7
    • ca-certificates : 20141019+deb8u3
    • curl : 7.38.0-4+deb8u8
    • gcc : 4:4.9.2-2
    • git : 1:2.1.4-2.1+deb8u5
    • inetutils-ping : 2:1.9.2.39.3a460-3
    • iproute2 : 3.16.0-2
    • libidn11 : 1.29-1+deb8u2
    • make : 4.0-8.1
    • openjdk-8-jre-headless : 8u131-b11-1~bpo8+1
    • openssh-client : 1:6.7p1-5+deb8u3
    • python : 2.7.9-1
    • unzip : 6.0-16+deb8u3
    • wget : 1.16-1+deb8u4
    • zip : 3.0-8

Tag schema

latest

The default version (aka latest) points at the latest tagged release by Emscripten.

Version release

sdk-tag-{VERSION}-{BITS}

  • VERSION: One of the official Emscripten tag released since 1.34.1
  • BITS: ["32bit", "64bit"]
    Example: sdk-tag-1.34.4-64bit

Branch release

sdk-{BRANCH}-{BITS}

  • BRANCH: ["incoming", "master"]
  • BITS: ["32bit", "64bit"]
    Example: sdk-master-32bit

Usage

Start volume should be mounted in /src.
For start point every Emscripten command is available. For the instance: emcc, em++, emmake, emar etc.

To compile a single file:
docker run --rm -v $(pwd):/src trzeci/emscripten emcc helloworld.cpp -o helloworld.js --closure 1

Hello World:

printf '#include <iostream>\nint main() { std::cout<<"HELLO FROM DOCKER C++"<<std::endl; return 0; }' > helloworld.cpp

docker run \
  --rm \
  -v $(pwd):/src \
  -u emscripten \
  trzeci/emscripten \
  emcc helloworld.cpp -o helloworld.js --closure 1

node helloworld.js

Teardown of compilation command:

part description
docker run A standard command to run a command in a container
--rm remove a container after execution
-v $(pwd):/src Mounting current folder from the host system, into /src of the image
-u emscripten (1.37.23+) Run a container as a non-root user emscripten, hence all files produced by this are accessible to non-root users
trzeci/emscripten Get the latest tag of this container
emcc helloworld.cpp -o helloworld.js --closure 1 Execute emcc command with following arguments inside container

How to compile?

  1. Pull the latest https://github.com/asRIA/emscripten-docker
  2. Compile Dockerfile

Helper command: ./build compile trzeci/emscripten:sdk-tag-1.37.17-64bit (where sdk-tag-1.37.17-64bit is an arbitrary tag)

Support

History

  • 1.37.23 Added curl, zip, unzip, upgrade to openjdk-jre-8
  • 1.37.21 Fixed missing ctest command
  • 1.37.21 image includes ssh and cache of libc libcxx is fixed.
  • 1.37.19 image doesn't use entrypoint from the base image.
  • 1.37.18 it contains perl and git package
  • 1.37.16 images are compiled from singe Dockerfile.
  • 1.37.10 images are bundled with java
  • 1.36.7 images are bundled with make and nodejs
  • 1.36.7 images are bundled with cmake 3.6.3, images are build from generated Dockerfiles
  • 1.35.0 images base on Debian
  • 1.34.X images base on Ubuntu:15.10

License

MIT

Docker Pull Command
Owner
trzeci