-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathDockerfile
More file actions
77 lines (63 loc) · 3.65 KB
/
Dockerfile
File metadata and controls
77 lines (63 loc) · 3.65 KB
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
# We build our DevContainer on MS' Typescript-Node Devcontainer
# This gives us lots of standard stuff, and lets us layer a few custom things on top, like the Emscripten compiler
# --------------------------------------------------------------------
# BEGIN Standard MS Devcontainer for Typescript-Node
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.155.1/containers/typescript-node/.devcontainer/base.Dockerfile
# Tags: https://mcr.microsoft.com/en-us/artifact/mar/devcontainers/typescript-node/tags
# [Choice] Node.js version: 18, 20, 22
ARG VARIANT="22-bookworm"
FROM mcr.microsoft.com/devcontainers/typescript-node:2-${VARIANT}
# [Optional] Uncomment if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
# [Optional] Uncomment if you want to install more global node packages
# RUN su node -c "npm install -g <your-package-list -here>"
# END Standard MS Devcontainer for Typescript-Node
# --------------------------------------------------------------------
# --------------------------------------------------------------------
# BEGIN EMSDK
# Install EMSDK to /emsdk just like the EMSDK Dockerfile: https://github.com/emscripten-core/emsdk/blob/master/docker/Dockerfile
ENV EMSDK=/emsdk
# We pin the EMSDK version rather than 'latest' so that everyone is using the same compiler version
ENV EMSCRIPTEN_VERSION=4.0.13
RUN git clone --depth=1 https://github.com/emscripten-core/emsdk.git $EMSDK
RUN echo "## Install Emscripten" \
&& cd ${EMSDK} \
&& ./emsdk install ${EMSCRIPTEN_VERSION} \
&& echo "## Done"
# Copied directly from https://github.com/emscripten-core/emsdk/blob/master/docker/Dockerfile
RUN cd ${EMSDK} \
&& echo "## Generate standard configuration" \
&& ./emsdk activate ${EMSCRIPTEN_VERSION} \
&& chmod 777 ${EMSDK}/upstream/emscripten \
&& chmod -R 777 ${EMSDK}/upstream/emscripten/cache \
&& echo "int main() { return 0; }" > hello.c \
&& ${EMSDK}/upstream/emscripten/emcc -c hello.c \
&& cat ${EMSDK}/upstream/emscripten/cache/sanity.txt \
&& echo "## Done"
ENV PATH=$EMSDK:$EMSDK/upstream/emscripten/:$PATH
# Cleanup Emscripten installation and strip some symbols
# Copied directly from https://github.com/emscripten-core/emsdk/blob/master/docker/Dockerfile
RUN echo "## Aggressive optimization: Remove debug symbols" \
&& cd ${EMSDK} && . ./emsdk_env.sh \
# Remove debugging symbols from embedded node (extra 7MB)
&& strip -s `which node` \
# Tests consume ~80MB disc space
&& rm -fr ${EMSDK}/upstream/emscripten/tests \
# Fastcomp is not supported
&& rm -fr ${EMSDK}/upstream/fastcomp \
# strip out symbols from clang (~extra 50MB disc space)
&& find ${EMSDK}/upstream/bin -type f -exec strip -s {} + || true \
&& echo "## Done"
RUN echo ". /emsdk/emsdk_env.sh" >> /etc/bash.bashrc
# We must set the EM_NODE_JS environment variable for a somewhat silly reason
# We run our build scripts with `npm run`, which sets the NODE environment variable as it runs.
# The EMSDK picks up on that environment variable and gives a deprecation warning: warning: honoring legacy environment variable `NODE`. Please switch to using `EM_NODE_JS` instead`
# So, we are going to put this environment variable here explicitly to avoid the deprecation warning.
RUN echo 'export EM_NODE_JS="$EMSDK_NODE"' >> /etc/bash.bashrc
# END EMSDK
# --------------------------------------------------------------------
# Install wget, gnupg, and sha3sum
RUN apt-get update \
&& apt-get install -y wget gnupg libdigest-sha3-perl \
&& rm -rf /var/lib/apt/lists/*