-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
50 lines (44 loc) · 1.51 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
FROM debian:11-slim
SHELL ["/bin/bash", "-c"]
ENV EMSCRIPTEN=/emsdk/upstream/emscripten
VOLUME /RNCryptor-C-wasm
RUN apt-get update \
&& apt-get install -y \
git \
wget \
python3 \
xz-utils \
build-essential
RUN git clone https://github.com/emscripten-core/emsdk.git && \
cd emsdk && \
git pull && \
./emsdk install latest && \
./emsdk activate latest && \
source ./emsdk_env.sh
RUN source /emsdk/emsdk_env.sh \
&& cd / && wget https://www.openssl.org/source/openssl-1.1.0h.tar.gz && \
tar xf openssl-1.1.0h.tar.gz && \
cd openssl-1.1.0h && \
emconfigure ./Configure linux-generic64 --prefix=$EMSCRIPTEN/system && \
sed -i 's|^CROSS_COMPILE.*$|CROSS_COMPILE=|g' Makefile && \
emmake make -j 12 build_generated libssl.a libcrypto.a && \
cp -R include/openssl $EMSCRIPTEN/system/include && \
cp -R include/openssl $EMSCRIPTEN/cache/sysroot/include && \
cp libcrypto.a libssl.a $EMSCRIPTEN/system/lib
COPY . /RNCryptor-C-wasm
WORKDIR /RNCryptor-C-wasm
RUN source /emsdk/emsdk_env.sh && mkdir -p dist/ && \
EMCC_DEBUG=1 emcc \
/RNCryptor-C-wasm/src/rncryptor.c \
/RNCryptor-C-wasm/RNCryptor-C/rncryptor_c.c \
/RNCryptor-C-wasm/RNCryptor-C/mutils.c \
-I RNCryptor-C $EMSCRIPTEN/system/lib/libssl.a $EMSCRIPTEN/system/lib/libcrypto.a \
-I $EMSCRIPTEN/cache/sysroot/include \
-s ERROR_ON_UNDEFINED_SYMBOLS=0 \
-s EXPORTED_RUNTIME_METHODS='["cwrap", "FS"]' \
-s ENVIRONMENT="web" \
-s ALLOW_MEMORY_GROWTH=1 \
-s EXPORT_ES6=1 \
-s MODULARIZE=1 \
-s WASM_ASYNC_COMPILATION=1 \
-o dist/rncryptor.js