Skip to content

Commit

Permalink
Add docker related files
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitsutoshi Aoe committed Feb 15, 2017
1 parent 3bb3f24 commit 93f3044
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM alpine:latest

RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
&& apk update \
&& apk upgrade \
&& apk add \
curl \
ghc@testing \
git \
musl-dev \
ncurses-dev \
&& curl -sSL https://get.haskellstack.org/ | sh 2>&1 \
&& adduser -S viewprof

USER viewprof
ENV PATH="/home/viewprof/.local/bin:$PATH"
WORKDIR /home/viewprof

RUN stack config set system-ghc --global true 2>&1 \
&& stack install viewprof 2>&1

ENTRYPOINT ["viewprof"]
CMD ["--help"]
5 changes: 5 additions & 0 deletions docker/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

DOCKER_DIR=$(realpath $(dirname "$0"))

docker build -f "$DOCKER_DIR/Dockerfile" -t viewprof .
12 changes: 12 additions & 0 deletions docker/viewprof
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

if [ -n "$1" ]; then
PROF_FILE=$(realpath "$1")
PROF_NAME=$(basename "$PROF_FILE")
fi

if [ -n "$PROF_FILE" -a -n "$PROF_NAME" ]; then
docker run --rm -it -v "$PROF_FILE:/home/viewprof/$PROF_NAME" viewprof "/home/viewprof/$PROF_NAME"
else
docker run --rm -it viewprof
fi

0 comments on commit 93f3044

Please sign in to comment.