Skip to content

Commit

Permalink
Merge pull request #43 from hugo-dc/dockerfile
Browse files Browse the repository at this point in the history
Add Dockerfile
  • Loading branch information
axic authored Mar 30, 2020
2 parents 7cc22ab + 1d58238 commit 46c3031
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM ubuntu:18.04

# System deps
RUN apt-get update
RUN apt-get install -y build-essential curl git python cmake
RUN apt-get install -y nodejs npm


# Install Rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y && . $HOME/.cargo/env
ENV PATH=/root/.cargo/bin:$PATH
RUN rustup default stable

RUN rustup target add wasm32-unknown-emscripten
RUN rustup target add asmjs-unknown-emscripten

# Install Emscripten
RUN git clone --depth 1 https://github.com/emscripten-core/emsdk.git
RUN cd emsdk && ./emsdk install latest
RUN cd emsdk && ./emsdk activate latest

ENV PATH=/emsdk:/emsdk/upstream/emscripten:/emsdk/node/12.9.1_64bit/bin:$PATH
ENV EMSDK=/emsdk
ENV EM_CONFIG=/root/.emscripten
ENV EMSDK_NODE=/emsdk/node/12.9.1_64bit/bin/node

RUN cd emsdk && ./emsdk_env.sh

WORKDIR /rustbn.js/

CMD /bin/bash

25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,29 @@ running:
make
```

### Docker

This repository also contains a `Dockefile` which makes it easier to install
the dependencies and tools described above in a docker container by following
the next instructions.

Build the docker image:

```
docker build . -t rustbn
```

Run the container:

```
docker run -v <path_to_the_rustbn.js_project>:/rustbn.js -it rustbn
```

Once inside the container the project can be compiled by executing:

```
make
```

### WASM (Experimental)

Expand Down Expand Up @@ -96,4 +119,4 @@ Licensed under either of
at your option.

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.


0 comments on commit 46c3031

Please sign in to comment.