Skip to content

Commit

Permalink
Merge pull request #34 from tmc/docker-dev
Browse files Browse the repository at this point in the history
[docker] add docker-based dev target
  • Loading branch information
tmc authored Jul 18, 2018
2 parents a238aaa + b8d7ac7 commit 31b3365
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
13 changes: 10 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@ FROM node:8-stretch

# build sybil
RUN apt-get update
RUN apt-get install -y golang-go
RUN apt-get install -y golang-go rsync
ENV GOPATH=/go
ENV PATH=/go/bin:$PATH
RUN go get -v github.com/logv/sybil # built-after:2018-05-15
RUN go get -v github.com/logv/sybil # built-after:2018-06-28

WORKDIR /snorkel
RUN npm install sqlite3 --build-from-source
RUN cp -r node_modules/sqlite3 /tmp/sqlite3

# if DEV is set to something install extra packages.
ARG DEV
RUN if [ -z "${DEV}" ]; then exit 0; else apt-get install -y vim; fi

COPY snorkel/package.json /snorkel/
COPY snorkel/package-lock.json /snorkel/
RUN npm install sqlite3 --build-from-source
RUN npm install
RUN rsync -Ap /tmp/sqlite3/ ./node_modules/sqlite3/

COPY snorkel /snorkel

Expand Down
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DOCKER_BUILD_ARGS ?=
.PHONY: all clean image run-image run-image-tour

all:
Expand All @@ -7,7 +8,10 @@ clean:
cd snorkel && rm -rf node_modules && cd ..

image:
docker build -t snorkel .
docker build -t snorkel $(DOCKER_BUILD_ARGS) .

dev: DOCKER_BUILD_ARGS = --build-arg DEV=1
dev: image run-image-dev

run-image:
docker run \
Expand All @@ -30,3 +34,16 @@ run-image-tour:
-p 59036:59036/udp \
-ti \
snorkel

run-image-dev:
docker run \
--rm \
-e SHOW_TOUR=true \
-e UPLOAD_CSV=true \
-e DATA_DIR=/var/data_dir \
-v $(shell pwd)/data_dir:/var/data_dir \
-v $(shell pwd)/snorkel/:/snorkel \
-p 3000:3000 \
-p 59036:59036/udp \
-ti \
snorkel bash

0 comments on commit 31b3365

Please sign in to comment.