Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored Docker Images To Use The Elasticseatch Docker Image As Their Base #425

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 14 additions & 40 deletions docker_containers/mindmeld_dep_docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,63 +7,37 @@
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# Pull base image.
FROM ubuntu:18.04

ENV ES_PKG_NAME elasticsearch-7.8.0-linux-x86_64
ENV ES_FOLDER_NAME elasticsearch-7.8.0
# Pull base elastisearch image
FROM elasticsearch:7.17.5

# System packages
RUN apt-get update && \
apt-get -y install software-properties-common curl vim
DEBIAN_FRONTEND="noninteractive" apt-get -y install software-properties-common build-essential curl vim tzdata wget

# Create directories
RUN mkdir /root/.pip /root/.mindmeld /data

# Install python pip
RUN apt-get -y install python-pip python3-pip python-dev build-essential && \
apt-get -y install software-properties-common

# Install Java
RUN apt update
RUN apt-get update
RUN apt-get install -y wget
RUN apt install openjdk-8-jdk -y

# Install duckling dependency
RUN apt-get -y update && \
DEBIAN_FRONTEND="noninteractive" apt-get -y upgrade tzdata

# set JAVA_HOME
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64

# Install Elasticsearch.
RUN \
cd / && \
wget https://artifacts.elastic.co/downloads/elasticsearch/$ES_PKG_NAME.tar.gz && \
tar xvzf $ES_PKG_NAME.tar.gz && \
rm -f $ES_PKG_NAME.tar.gz && \
mv /$ES_FOLDER_NAME /elasticsearch
# Install Python 3.6
RUN add-apt-repository -y ppa:deadsnakes/ppa && \
apt-get install --no-install-recommends -y python3.6 python3.6-dev python3.6-distutils
# Register Python 3.6 as the preferred version to use when running python3
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1

RUN useradd -ms /bin/bash mindmeld
RUN mkdir /elasticsearch/log
RUN chown -R mindmeld:mindmeld /elasticsearch /data /var/log

RUN mkdir -p /elasticsearch/log
RUN chown -R mindmeld:mindmeld /elasticsearch /usr/share/elasticsearch /data /var/log

# Add Config Files
COPY ./conf/elasticsearch.yml /elasticsearch/config/elasticsearch.yml
COPY ./conf/elasticsearch.yml /usr/share/elasticsearch/config/elasticsearch.yml

WORKDIR /root

RUN curl -o /tmp/get-pip.py https://bootstrap.pypa.io/pip/3.6/get-pip.py
RUN python3 /tmp/get-pip.py

# system as both 2 and 3, make 3 the default
RUN echo alias python=python3 >> /root/.bashrc
RUN echo alias pip=pip3 >> /root/.bashrc

RUN pip3 install --upgrade pip
RUN pip3 install -U mindmeld
# Install spacy with mindmeld to ensure a version new enough is installed to install en_core_web_sm
RUN pip3 install -U mindmeld spacy
RUN pip3 install click-log==0.1.8

RUN export LC_ALL=C.UTF-8 && \
Expand All @@ -80,5 +54,5 @@ EXPOSE 7151
ENTRYPOINT export LC_ALL=C.UTF-8 && \
export LANG=C.UTF-8 && \
pip3 install mindmeld --upgrade && \
su mindmeld -c "ES_JAVA_OPTS='-Xms1g -Xmx1g' /elasticsearch/bin/elasticsearch"
su mindmeld -c "ES_JAVA_OPTS='-Xms1g -Xmx1g' /usr/share/elasticsearch/bin/elasticsearch"

54 changes: 14 additions & 40 deletions docker_containers/mindmeld_docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,28 @@
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# Pull base image.
FROM ubuntu:18.04

ENV ES_PKG_NAME elasticsearch-7.8.0-linux-x86_64
ENV ES_FOLDER_NAME elasticsearch-7.8.0
# Pull base elastisearch image
FROM elasticsearch:7.17.5

# System packages
RUN apt-get update && \
apt-get -y install software-properties-common curl vim
DEBIAN_FRONTEND="noninteractive" apt-get -y install software-properties-common build-essential curl vim tzdata wget

# Create directories
RUN mkdir /root/.pip /root/.mindmeld /data

# Install python pip
RUN apt-get -y install python-pip python3-pip python-dev build-essential && \
apt-get -y install software-properties-common

# Install Java
RUN apt update
RUN apt-get update
RUN apt-get install -y wget
RUN apt install openjdk-8-jdk -y

# Install duckling dependency
RUN apt-get -y update && \
DEBIAN_FRONTEND="noninteractive" apt-get -y upgrade tzdata

# set JAVA_HOME
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64

# Install Elasticsearch.
RUN \
cd / && \
wget https://artifacts.elastic.co/downloads/elasticsearch/$ES_PKG_NAME.tar.gz && \
tar xvzf $ES_PKG_NAME.tar.gz && \
rm -f $ES_PKG_NAME.tar.gz && \
mv /$ES_FOLDER_NAME /elasticsearch
# Install Python 3.6
RUN add-apt-repository -y ppa:deadsnakes/ppa && \
apt-get install --no-install-recommends -y python3.6 python3.6-dev python3.6-distutils
# Register Python 3.6 as the preferred version to use when running python3
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1

RUN useradd -ms /bin/bash mindmeld
RUN mkdir /elasticsearch/log
RUN chown -R mindmeld:mindmeld /elasticsearch /data /var/log

RUN mkdir -p /elasticsearch/log
RUN chown -R mindmeld:mindmeld /elasticsearch /usr/share/elasticsearch /data /var/log

# Add Config Files
COPY ./conf/elasticsearch.yml /elasticsearch/config/elasticsearch.yml
COPY ./conf/elasticsearch.yml /usr/share/elasticsearch/config/elasticsearch.yml

# Add Cluster Status Script
COPY ./wait_for_cluster_to_turn_green.sh /wait_for_cluster_to_turn_green.sh
Expand All @@ -61,11 +38,8 @@ WORKDIR /root
RUN curl -o /tmp/get-pip.py https://bootstrap.pypa.io/pip/3.6/get-pip.py
RUN python3 /tmp/get-pip.py

# system as both 2 and 3, make 3 the default
RUN echo alias python=python3 >> /root/.bashrc
RUN echo alias pip=pip3 >> /root/.bashrc

RUN pip3 install --upgrade pip
# Install spacy with mindmeld to ensure a version new enough is installed to install en_core_web_sm
RUN pip3 install -U mindmeld spacy
RUN pip3 install click-log==0.1.8

Expand All @@ -79,7 +53,7 @@ RUN mkdir -p home_assistant && \

RUN export LC_ALL=C.UTF-8 && \
export LANG=C.UTF-8 && \
su mindmeld -c "ES_JAVA_OPTS='-Xms1g -Xmx1g' /elasticsearch/bin/elasticsearch -d" && \
su mindmeld -c "ES_JAVA_OPTS='-Xms1g -Xmx1g' /usr/share/elasticsearch/bin/elasticsearch -d" && \
mindmeld num-parse --start && \
python3 -m home_assistant build

Expand All @@ -92,7 +66,7 @@ EXPOSE 7150

ENTRYPOINT export LC_ALL=C.UTF-8 && \
export LANG=C.UTF-8 && \
su mindmeld -c "ES_JAVA_OPTS='-Xms1g -Xmx1g' /elasticsearch/bin/elasticsearch -d" && \
su mindmeld -c "ES_JAVA_OPTS='-Xms1g -Xmx1g' /usr/share/elasticsearch/bin/elasticsearch -d" && \
mindmeld num-parse --start && \
/wait_for_cluster_to_turn_green.sh && \
python3 -m home_assistant run