-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Add Dockerfile and shim (#47)
* build: Add Dockerfile and shims * build: Publish dockerfile to docker hub * build: Fix permisson error when writing in docker * fix: Fix wrong ouput if no given model * docs(docker): Add documentation for running with docker
- Loading branch information
Showing
4 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM ubuntu:18.04 | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV BASE_DIR /usr/local | ||
ENV APP_DIR $BASE_DIR/smore | ||
|
||
RUN apt-get update \ | ||
&& apt-get -y install g++-7 make\ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY cli $APP_DIR/cli | ||
COPY src $APP_DIR/src | ||
COPY ./entrypoint.sh $APP_DIR | ||
COPY Makefile $APP_DIR | ||
WORKDIR $APP_DIR | ||
|
||
RUN make CC=g++-7 | ||
ENTRYPOINT ["./entrypoint.sh"] | ||
VOLUME ["$APP_DIR/data"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
if [ $# -lt 1 ];then | ||
echo "Usage:\n ./smore.sh model_name -train training_dataset -save embedding [model_options]" | ||
echo "Example:\n ./smore.sh hpe -train net.txt -save rep.txt" | ||
exit 1 | ||
fi | ||
args=( "$@" ) | ||
for ((i=0; i < $#; i++)) ;do | ||
next_arg=$((i+1)) | ||
if [ "${args[$i]}" == "-train" ] || [ "${args[$i]}" == "-save" ]; then | ||
args[${next_arg}]="data/"${args[${next_arg}]} | ||
fi | ||
done | ||
set "${args[@]}" | ||
exec "./cli/$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
if [ $# -lt 1 ];then | ||
echo "Usage:\n ./smore.sh model_name -train training_dataset -save embedding [model_options]" | ||
echo "Example:\n ./smore.sh hpe -train net.txt -save rep.txt" | ||
exit 1 | ||
fi | ||
IMAGE=josix/smore:latest | ||
docker run -it --name smore --rm --user="$(id -u):$(id -g)" -v "$PWD":/usr/local/smore/data "$IMAGE" "$@" |