Skip to content

Commit

Permalink
Docker image builds correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
louieQ committed Jan 31, 2019
1 parent f3cf006 commit 23ad278
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 0 deletions.
68 changes: 68 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
FROM python:2.7

# Install Git LFS
RUN echo 'deb http://http.debian.net/debian stretch-backports main' > /etc/apt/sources.list.d/stretch-backports-main.list && \
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
apt-get -y update && \
apt-get -y install git-lfs && \
git lfs install

# ============================================= #
# Clone the datasets and projects' repositories #
# ============================================= #

# Dataset
RUN git clone https://github.com/collab-uniba/EMTK_datasets.git datasets

# Emotions
RUN git clone https://github.com/collab-uniba/Emotion_and_Polarity_SO.git emotions
RUN wget -P /emotions/java/lib http://nlp.stanford.edu/software/stanford-corenlp-models-current.jar

# Polarity
RUN git lfs clone https://github.com/collab-uniba/Senti4SD.git polarity


# ====== #
# PYTHON #
# ====== #

# Install python requirements
COPY requirements.txt /
RUN pip install --upgrade pip && \
pip install -r /requirements.txt
RUN python -m nltk.downloader all
RUN rm requirements.txt


# ==== #
# JAVA #
# ==== #

# Install Java 8 JRE
RUN apt-get -y update && \
apt-get -y install default-jre


# ====== #
# R-base #
# ====== #

# Install R
RUN apt-get -y update && \
apt-get -y install r-base

# Install R requirements
COPY requirements.R /
RUN Rscript requirements.R
RUN rm requirements.R

# ========== #
# ENTRYPOINT #
# ========== #

# Copy the main bash script onto the image and make it a command
COPY ./emtk /
RUN ln -s /emtk /usr/bin/emtk

# Run the bash inside the container when it starts
ENTRYPOINT [ "/bin/bash" ]
37 changes: 37 additions & 0 deletions emtk
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

module=$1
if [ $module = "polarity" ]
then
# POLARITY MODULE
cd ./polarity/ClassificationTask/
exec sh classificationTask.sh ${@:2}

elif [ $module = "emotions" ]
then
# EMOTIONS MODULE
task=$2

if [ $task = "train" ]
then

# Train
cd ./emotions
exec sh train.sh ${@:3}
elif [ $task = "classify" ]
then

# Classify
cd ./emotions
exec sh classify.sh ${@:3}
else
# wrong/missing task name
echo "Check the first argument after 'emotions':"
echo "There is no task named '$1'!"
fi

else
# WRONG/MISSING MODULE NAME
echo "Check the first argument after './emtk.sh':"
echo "There is no module named '$1'!"
fi
18 changes: 18 additions & 0 deletions requirements.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#check if caret is present
#if not, it will be installed
if(!require("caret", quietly = TRUE)) {
install.packages(c("caret"), dependencies = c("Imports", "Depends","LinkingTo"), repos = "http://cran.mirror.garr.it/mirrors/CRAN/")
}

#check if LiblineaR is present
#if not, it will be installed
if(!require("LiblineaR", quietly = TRUE)) {
install.packages(c("LiblineaR"), dependencies = c("Imports", "Depends","LinkingTo"), repos = "http://cran.mirror.garr.it/mirrors/CRAN/")
}

#check if e1071 is present
#if not, it will be installed
if(!require("e1071", quietly = TRUE)) {
install.packages(c("e1071"), dependencies = c("Imports", "Depends","LinkingTo"), repos = "http://cran.mirror.garr.it/mirrors/CRAN/")
}

6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
scipy==0.12.0
numpy==1.9.0
scikit-learn==0.15.1
nltk==3.0.0
pattern==2.6
nose==1.3.7

0 comments on commit 23ad278

Please sign in to comment.