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

Create Dockerfile #103

Closed
wants to merge 1 commit into from
Closed
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
52 changes: 52 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM ubuntu:14.04
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ubuntu is fine but I would research the smallest image available that already have what you need to run odm2adim.


ENV LANG=C.UTF-8 LC_ALL=C.UTF-8

LABEL description='Django admin app for Observation Data Model 2 (ODM2)' \
url='https://github.com/miguelcleon/ODM2-Admin' \
author='Miguel Leon' \
author_email='leonmi@sas.upenn.edu' \
development_status='5 - Production/Stable' \
environment='Console' \
intended_audience='Science/Research, Developers, Education' \
license='MIT License' \
operating_system='OS Independent' \
programming_language='Python' \
topic='Scientific/Engineering, Education'

EXPOSE 8000
EXPOSE 5432

# Setting up Miniconda
RUN apt-get update --fix-missing && apt-get install -y wget bzip2 ca-certificates \
libglib2.0-0 libxext6 libsm6 libxrender1 \
git mercurial subversion \
nano curl tar

RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh && \
wget --quiet https://repo.continuum.io/miniconda/Miniconda2-4.1.11-Linux-x86_64.sh -O ~/miniconda.sh && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I would used the latest link instead of a version and update conda here in the dockerfile.
Conda is a evolving fast and it is nice to always test/run against the latest version.

/bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh

RUN apt-get install -y curl grep sed dpkg && \
TINI_VERSION=`curl https://github.com/krallin/tini/releases/latest | grep -o "/v.*\"" | sed 's:^..\(.*\).$:\1:'` && \
curl -L "https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini_${TINI_VERSION}.deb" > tini.deb && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, why do you need this?

dpkg -i tini.deb && \
rm tini.deb && \
apt-get clean

ENV PATH /opt/conda/bin:$PATH

# Setting up postgresql database
RUN apt-get update --fix-missing && apt-get install -y postgresql postgresql-contrib postgis postgresql-9.3-postgis-2.1

RUN git clone "https://github.com/miguelcleon/ODM2-Admin"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you may want to get a specific version instead of latest master. (Unless the goal is testing and not shipping.)


RUN service postgresql start && sudo -u postgres createdb odm2_db && \
sudo -u postgres pg_restore -d odm2_db -1 -v "/ODM2-Admin/ODM2AdminExamplePostgresqlDB" && \
sudo -u postgres psql -U postgres -d postgres -c "alter user postgres with password 'test';"

# creates an env with the depepencies
RUN conda create --yes -n odm2adminenv python=2.7 --file /ODM2-Admin/requirements.txt

CMD ["/bin/bash"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may need to issue a ENV DJANGO_SETTINGS_MODULE something.odm2adim.here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't we want to activate the environment here? Then run this?
python /ODM2-Admin/manage.py runserver