Skip to content

Commit 46c3031

Browse files
authored
Merge pull request #43 from hugo-dc/dockerfile
Add Dockerfile
2 parents 7cc22ab + 1d58238 commit 46c3031

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM ubuntu:18.04
2+
3+
# System deps
4+
RUN apt-get update
5+
RUN apt-get install -y build-essential curl git python cmake
6+
RUN apt-get install -y nodejs npm
7+
8+
9+
# Install Rust
10+
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y && . $HOME/.cargo/env
11+
ENV PATH=/root/.cargo/bin:$PATH
12+
RUN rustup default stable
13+
14+
RUN rustup target add wasm32-unknown-emscripten
15+
RUN rustup target add asmjs-unknown-emscripten
16+
17+
# Install Emscripten
18+
RUN git clone --depth 1 https://github.com/emscripten-core/emsdk.git
19+
RUN cd emsdk && ./emsdk install latest
20+
RUN cd emsdk && ./emsdk activate latest
21+
22+
ENV PATH=/emsdk:/emsdk/upstream/emscripten:/emsdk/node/12.9.1_64bit/bin:$PATH
23+
ENV EMSDK=/emsdk
24+
ENV EM_CONFIG=/root/.emscripten
25+
ENV EMSDK_NODE=/emsdk/node/12.9.1_64bit/bin/node
26+
27+
RUN cd emsdk && ./emsdk_env.sh
28+
29+
WORKDIR /rustbn.js/
30+
31+
CMD /bin/bash
32+

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,29 @@ running:
6262
make
6363
```
6464

65+
### Docker
66+
67+
This repository also contains a `Dockefile` which makes it easier to install
68+
the dependencies and tools described above in a docker container by following
69+
the next instructions.
70+
71+
Build the docker image:
72+
73+
```
74+
docker build . -t rustbn
75+
```
76+
77+
Run the container:
78+
79+
```
80+
docker run -v <path_to_the_rustbn.js_project>:/rustbn.js -it rustbn
81+
```
82+
83+
Once inside the container the project can be compiled by executing:
84+
85+
```
86+
make
87+
```
6588

6689
### WASM (Experimental)
6790

@@ -96,4 +119,4 @@ Licensed under either of
96119
at your option.
97120

98121
Copyright 2016 [Zcash Electric Coin Company](https://z.cash/). The Zcash Company promises to maintain the "bn" crate on crates.io under this MIT/Apache-2.0 dual license.
99-
122+

0 commit comments

Comments
 (0)