-
Notifications
You must be signed in to change notification settings - Fork 29
/
Dockerfile
100 lines (94 loc) · 3.93 KB
/
Dockerfile
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
ARG EMSCRIPTEN_VERSION=1.38.33
FROM trzeci/emscripten-slim:sdk-tag-${EMSCRIPTEN_VERSION}-64bit
# ------------------------------ ABOUT THIS IMAGE -----------------------------
# This image shows one way of extending base image which is `emscripten-slim` by
# extra tools.
# Major advantage of this was is simplicity, as all environment is already set
# by the base image. Major flaw is that we stick to underlying Debian image.
# To see another way of extending `emscritpen-slim` please look at `emscripten-ubuntu`
# ------------------------------------------------------------------------------
RUN echo "## Start building" \
\
&& echo "## Update and install packages" \
&& apt-get -qq -y update \
# mitigate problem with create symlink to man
&& mkdir -p /usr/share/man/man1/ \
&& apt-get -qq install -y --no-install-recommends \
wget \
curl \
zip \
unzip \
git \
ssh-client \
ca-certificates \
build-essential \
make \
ant \
libidn11 \
openjdk-8-jre-headless \
\
&& echo "## Installing CMake" \
&& wget https://cmake.org/files/v3.18/cmake-3.18.3-Linux-x86_64.sh -q \
&& mkdir /opt/cmake \
&& printf "y\nn\n" | sh cmake-3.18.3-Linux-x86_64.sh --prefix=/opt/cmake > /dev/null \
&& rm -fr cmake*.sh /opt/cmake/doc \
&& rm -fr /opt/cmake/bin/cmake-gui \
&& rm -fr /opt/cmake/bin/ccmake \
&& rm -fr /opt/cmake/bin/cpack \
&& ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake \
&& ln -s /opt/cmake/bin/ctest /usr/local/bin/ctest \
\
# activate emscripten in order to setup environment
&& . ${EMSDK}/emsdk_set_env.sh \
&& printf "JAVA='$(which java)'\n" >> $EM_CONFIG \
\
&& sleep 2 \
&& touch ${EM_CONFIG}_sanity \
\
&& emcc --version \
\
&& emcc --clear-cache --clear-ports \
\
&& echo "## Compile Emscripten Ports" \
&& ${EMSCRIPTEN}/embuilder.py build ALL \
\
# Manual remove cache / ports in order to keep precompiled libc/libcxx
&& rm -fr ${EM_CACHE}/asmjs/ports-builds \
&& rm -fr ${EM_PORTS} \
\
&& echo "## Compile sample code" \
&& mkdir -p /tmp/emscripten_test && cd /tmp/emscripten_test \
&& printf '#include <iostream>\nint main(){std::cout<<"HELLO FROM DOCKER C++"<<std::endl;return 0;}' > test.cpp \
&& em++ -O2 test.cpp -o test.js && node test.js \
&& em++ test.cpp -o test.js && node test.js \
&& em++ test.cpp -o test.js --closure 1 && node test.js \
\
&& cd / \
&& rm -fr /tmp/emscripten_test \
\
&& echo "## Cleaning up" \
&& apt-mark manual make openjdk-8-jre-headless wget gcc git \
&& apt-get -y remove openjdk-7-jre-headless \
&& 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/* \
&& rm -rf /usr/share/man/?? \
&& rm -rf /usr/share/man/??_* \
# && cp -R /usr/share/locale/en\@* /tmp/ && rm -rf /usr/share/locale/* && mv /tmp/en\@* /usr/share/locale/ \
\
&& chmod -R 777 ${EM_DATA} \
&& echo "## Done"
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/jre
# ------------------------------------------------------------------------------
# Copy this Dockerimage into image, so that it will be possible to recreate it later
COPY Dockerfile /emsdk_portable/dockerfiles/trzeci/emscripten/
LABEL maintainer="[email protected]" \
org.label-schema.name="emscripten" \
org.label-schema.description="Regular version of Emscripten compiler what should be suitable to compile majority of C++ projects for Emscripten, ASM.js and WebAssembly." \
org.label-schema.url="https://trzeci.eu" \
org.label-schema.vcs-url="https://github.com/trzecieu/emscripten-docker" \
org.label-schema.docker.dockerfile="/docker/trzeci/emscripten/Dockerfile"
# ------------------------------------------------------------------------------