Skip to content

Commit

Permalink
Add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
adriankumpf committed Mar 31, 2018
1 parent 62e09fb commit bf575af
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.formatter.exs
.git/
.gitignore
Dockerfile
Dockerfile
README.md
_build/
deps/
test/
51 changes: 51 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
FROM erlang:20.3

ENV ELIXIR_VERSION="v1.6.4" \
RUST_VERSION="1.25.0" \
LANG="C.UTF-8" \
MIX_ENV="prod" \
HOME=/opt/app

WORKDIR $HOME

RUN apt-get update && \
apt-get install \
ca-certificates \
curl \
gcc \
libc6-dev \
libusb-1.0-0-dev \
psmisc \
-qqy \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

# Install Elixir
RUN set -xe \
&& ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \
&& curl -fSL -o elixir-src.tar.gz $ELIXIR_DOWNLOAD_URL \
&& mkdir -p /usr/local/src/elixir \
&& tar -xzC /usr/local/src/elixir --strip-components=1 -f elixir-src.tar.gz \
&& rm elixir-src.tar.gz \
&& cd /usr/local/src/elixir \
&& make install clean

# Install Hex
RUN mix do local.hex --force, local.rebar --force

# Install Rust
RUN RUST_ARCHIVE="rust-$RUST_VERSION-x86_64-unknown-linux-gnu.tar.gz" && \
RUST_DOWNLOAD_URL="https://static.rust-lang.org/dist/$RUST_ARCHIVE" && \
mkdir -p /rust \
&& cd /rust \
&& curl -fsOSL $RUST_DOWNLOAD_URL \
&& curl -s $RUST_DOWNLOAD_URL.sha256 | sha256sum -c - \
&& tar -C /rust -xzf $RUST_ARCHIVE --strip-components=1 \
&& rm $RUST_ARCHIVE \
&& ./install.sh

COPY . .

RUN mix do deps.get, deps.compile, compile.rustler

CMD ["iex", "-S", "mix"]
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ iex> Arb.activate([1, 4, 7])
iex> Arb.get_active()
{:ok, [1, 4, 7]}
```

## Development

```bash
docker build -t arb-ex .
docker run --privileged -it arb-ex
```

0 comments on commit bf575af

Please sign in to comment.