forked from trzecieu/emscripten-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.in
57 lines (54 loc) · 1.96 KB
/
Dockerfile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
FROM ubuntu
MAINTAINER me@invokr.org
ENV DEBIAN_FRONTEND noninteractive
RUN rm /bin/sh && ln -s /bin/bash /bin/sh \
&& apt-get -y update && apt-get install -y --no-install-recommends \
cmake git-core ca-certificates build-essential python nodejs \
\
&& git clone --depth 1 https://github.com/juj/emsdk.git emsdk_portable \
&& cd emsdk_portable \
&& rm -fr .git \
&& rm -fr bin \
&& echo {EMSCRIPTEN_TAG} > emscripten-tags.txt \
&& ./emsdk install --build=MinSizeRel {EMSCRIPTEN_SDK} \
&& ./emsdk activate {EMSCRIPTEN_SDK} \
\
&& sed -i -e 's/NODE_JS=.*/NODE_JS="nodejs"/g' ~/.emscripten \
&& find . -name "CMakeFiles" -type d -prune -exec rm -fr {} \; \
&& find . -name "*.o" -exec rm {} \; \
&& find . -name "*.a" -exec rm {} \; \
&& emscripten_version=$(find clang/*/src/emscripten-version.txt) \
&& mv $emscripten_version emscripten-version.txt \
&& rm -rf clang/*/src \
&& mkdir -p $(echo "$(dirname "$emscripten_version")") \
&& mv emscripten-version.txt $emscripten_version \
&& rm -rf emscripten/*/.git \
&& rm -rf zips \
&& rm -rf node \
&& rm -rf emscripten/*/tests \
\
&& for prog in em++ em-config emar emcc emconfigure emmake emranlib emrun emscons emcmake; do \
ln -sf /emsdk_portable/emscripten/{EMSCRIPTEN_SDK_DIR}/$prog /usr/local/bin; done \
\
&& EMSCRIPTEN=/emsdk_portable/emscripten/{EMSCRIPTEN_SDK_DIR} \
\
&& emcc --version \
\
&& mkdir -p /tmp/emscripten_test && cd /tmp/emscripten_test \
&& printf '#include <iostream>\nint main(){std::cout<<"HELLO"<<std::endl;return 0;}' > test.cpp \
&& em++ -O2 test.cpp -o test.js && nodejs test.js \
&& em++ test.cpp -o test.js && nodejs test.js \
&& cd / \
&& rm -fr /tmp/emscripten_test \
\
&& apt-get -y --purge remove build-essential gcc perl git-core ca-certificates \
&& apt-get -y clean \
&& apt-get -y autoclean \
&& apt-get -y autoremove \
\
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/debconf/*-old \
&& rm -rf /usr/share/doc/*
# SETUP SDK
ENV EMSCRIPTEN=/emsdk_portable/emscripten/{EMSCRIPTEN_SDK_DIR}
WORKDIR /src