Skip to content

Commit

Permalink
Modify the dockerfile to work with the new setup scripts
Browse files Browse the repository at this point in the history
- Retrieve the most recent ubuntu image
- Ensure that we install curl and git
- Run the `source setup` command using bash so that everything is installed in the image
- Remove the node installation since:
    - it doesn't work with the most recent ubuntu
    - with microservices, we don't really want to lump the webapp and the REST
      API together in one service (so this is really part of the long-awaited
      server modularization)
    - copy in a static index.html to display instead
- Put everything into e-mission-server instead of /usr/src/app (at least for
  now) to be consistent with the dev image
- Run the activate script instead of activating only the environment

Testing done:
- created a docker image with the modifications
- ran it and ensured that I could see the new index.html
  • Loading branch information
shankari committed Oct 23, 2020
1 parent 8bd464e commit 3836c23
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
33 changes: 15 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
# python 3
FROM continuumio/miniconda3:4.5
FROM ubuntu:latest

MAINTAINER K. Shankari (shankari@eecs.berkeley.edu)
# set working directory
WORKDIR /usr/src/app

RUN apt-get update
RUN apt-get install -y curl
RUN apt-get install -y git

# clone from repo
RUN git clone https://github.com/e-mission/e-mission-server.git .
RUN git clone https://github.com/e-mission/e-mission-server.git
WORKDIR /usr/src/app/e-mission-server

# setup python environment.
RUN conda env update --name emission --file setup/environment36.yml
RUN conda clean -t
RUN conda clean -p
RUN bash -c 'source setup/setup_conda.sh Linux-x86_64; \
source setup/setup.sh'

# install nodejs, npm and bower
RUN apt-get update
RUN apt-get install -y build-essential
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get -y install nodejs
RUN npm install -g bower
WORKDIR /usr/src/app/webapp
RUN bower update --allow-root
WORKDIR /usr/src/app
RUN bash -c 'source setup/activate_conda.sh; conda clean -t; conda clean -p'

# install nano and vim for editing
RUN apt-get -y install nano vim
Expand All @@ -37,10 +33,11 @@ ENV WEB_SERVER_HOST=''
#add start script.
# this is a redundant workdir setting, but it doesn't harm anything and might
# be useful if the other one is removed for some reason
WORKDIR /usr/src/app
ADD start_script.sh /usr/src/app/start_script.sh
RUN chmod u+x /usr/src/app/start_script.sh
WORKDIR /usr/src/app/e-mission-server
ADD start_script.sh /usr/src/app/e-mission-server/start_script.sh
ADD index.html /usr/src/app/e-mission-server/webapp/www/index.html
RUN chmod u+x /usr/src/app/e-mission-server/start_script.sh

EXPOSE 8080

CMD ["/bin/bash", "/usr/src/app/start_script.sh"]
CMD ["/bin/bash", "/usr/src/app/e-mission-server/start_script.sh"]
11 changes: 11 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<html>
<body>
<h1>e-mission server running successfully!</h1>
<h3>Congratulations!</h3>
<ol>
<li> Your instance of the e-mission server (<a href="https://github.com/e-mission/e-mission-server/">https://github.com/e-mission/e-mission-server/</a>) is running successfully.
<li> Additional documentation is at <a href="https://github.com/e-mission/e-mission-docs/">https://github.com/e-mission/e-mission-docs/</a>
<li> Make sure to set up the analysis server as well!
</ol>
</body>
</html>
4 changes: 2 additions & 2 deletions start_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cat conf/storage/db.conf

#set Web Server host using environment variable
echo ${WEB_SERVER_HOST}
if [ -z ${WEB_SERVER_HOST}} ] ; then
if [ -z ${WEB_SERVER_HOST} ] ; then
local_host=`hostname -i`
sed "s_localhost_${local_host}_" conf/net/api/webserver.conf.sample > conf/net/api/webserver.conf
else
Expand All @@ -23,7 +23,7 @@ cat conf/net/api/webserver.conf

#TODO: start cron jobs
# change python environment
source activate emission
source setup/activate.sh

# launch the webapp
./e-mission-py.bash emission/net/api/cfc_webapp.py

0 comments on commit 3836c23

Please sign in to comment.