docker/api-async/Dockerfile
2020-02-24 14:49:33 -05:00

217 lines
8.5 KiB
Docker

#vizier web-api-async
#FROM docker.mimirdb.info/alpine_oraclejdk8
FROM docker.mimirdb.info/alpine_openjdk8
# Metadata
LABEL base.image="docker.mimirdb.info/alpine_oraclejdk8"
LABEL version="0.4"
LABEL software="Vizier"
LABEL software.version="0.2.20200202"
LABEL description="an open source, provenance aware, iterative data cleaning tool"
LABEL website="http://vizierdb.info"
LABEL sourcecode="https://github.com/VizierDB"
LABEL documentation="https://github.com/VizierDB/web-api/wiki"
LABEL tags="CSV,Data Cleaning,Databases,Provenance,Workflow,Machine Learning"
ARG gituser
ARG gitpass
ARG API_BRANCH=master
#General
# Web service name
ENV VIZIERSERVER_NAME=vizier
#Log file directory used by the web server (DEFAULT: ./.vizierdb/logs)
ENV VIZIERSERVER_LOG_DIR=/usr/local/source/web-api/vizier/.vizierdb/logs
# Flag indicating whether server is started in debug mode (DEFAULT: True)
ENV VIZIERSERVER_DEBUG=True
#Web Service
# Base URL of the server running the web service (DEFAULT: http://localhost)
ENV VIZIERSERVER_BASE_URL=http://localhost
# Public server port (DEFAULT: 5000)
ENV VIZIERSERVER_SERVER_PORT=5000
# Locally bound server port (DEFAULT: 5000)
ENV VIZIERSERVER_SERVER_LOCAL_PORT=5000
# Application path for Web API (DEFAULT: /vizier-db/api/v1)
ENV VIZIERSERVER_APP_PATH=/vizier-db/api/v1
# Default row limit for requests that read datasets (DEFAULT: 25)
ENV VIZIERSERVER_ROW_LIMIT=25
# Maximum row limit for requests that read datasets (DEFAULT: -1 (returns all rows))
ENV VIZIERSERVER_MAX_ROW_LIMIT=-1
# Maximum size for file uploads in bytes (DEFAULT: 16777216)
ENV VIZIERSERVER_MAX_UPLOAD_SIZE=16777216
#Workflow Execution Engine
# Name of the workflow execution engine (DEFAULT: DEV)
ENV VIZIERSERVER_ENGINE=MIMIR
# Path to the package declaration directory (DEFAULT: ./resources/packages/common)
ENV VIZIERSERVER_PACKAGE_PATH=/usr/local/source/web-api/resources/packages/common:/usr/local/source/web-api/resources/packages/mimir
# Path to the task processor definitions for supported packages (DEFAULT: ./resources/processors/common:./resources/processors/dev)
ENV VIZIERSERVER_PROCESSOR_PATH=/usr/local/source/web-api/resources/processors/common:/usr/local/source/web-api/resources/processors/mimir
#Workflow Engine
# Name of the execution backend. The currently implemented backends are CELERY, MULTIPROCESS, or CONTAINER (DEFAULT: MULTIPROCESS).
ENV VIZIERENGINE_BACKEND=MULTIPROCESS
# Colon separated list of package.command strings that identify the commands that are executed synchronously (DEFAULT: None)
ENV VIZIERENGINE_SYNCHRONOUS=
# Flag indicating whether short identifiers (eight characters instead of 32) are used by the viztrail repository (DEFAULT: True)
ENV VIZIERENGINE_USE_SHORT_IDENTIFIER=True
# Base data directory for storing data. The datastore, filestore, and viztrail repository will create sub-folders in the directory for maintaining information and resources they maintain.
ENV VIZIERENGINE_DATA_DIR=/usr/local/source/web-api/vizier/.vizierdb
#CELERY Backend
# Colon separated list of package.command.queue strings that define routing information for individual commands (DEFAULT: None)
ENV VIZIERENGINE_CELERY_ROUTES=
# URL for the celery broker (DEFAULT: amqp://guest@localhost//)
ENV CELERY_BROKER_URL=amqp://guest@localhost//
#CELERY Worker Configuration
# Identifier for environment in which the worker operates (supported values are DEV, MIMIR, and REMOTE) (DEFAULT: DEV)
ENV VIZIERWORKER_ENV=MIMIR
# Path to the task processor definitions for supported packages (DEFAULT: ./resources/processors/common:./resources/processors/dev)
ENV VIZIERWORKER_PROCESSOR_PATH=/usr/local/source/web-api/resources/processors/common:/usr/local/source/web-api/resources/processors/mimir
# Log file directory used by the worker (DEFAULT: ./.vizierdb/logs/worker)
ENV VIZIERWORKER_LOG_DIR=/usr/local/source/web-api/vizier/.vizierdb/logs/worker
# URL of the controlling web service (DEFAULT: http://localhost:5000/vizier-db/api/v1)
ENV VIZIERWORKER_CONTROLLER_URL=http://localhost:5000/vizier-db/api/v1
#CONTAINER Backend
# List of port numbers for new project containers. Expects a comma-separated list of port number of number intervals (e.g. 8080-8088,9000,9090-9099) (DEFAULT: 20171-20271)
ENV VIZIERENGINE_CONTAINER_PORTS=20171-20271
# Unique identifier of the docker image for project containers (DEFAULT: heikomueller/vizierapi:container)
ENV VIZIERENGINE_CONTAINER_IMAGE=heikomueller/vizierapi:container
#misc
ENV PROFILER=0
ENV MIMIR_HOST="vizier-mimir.local"
ENV MIMIR_URL="http://vizier-mimir.local:8089/api/v2"
ENV RUN_SSH=true
ENV ACME_HOSTS="api.vizier.app"
ENV GLIBC_VERSION 2.27-r0
EXPOSE 9001
EXPOSE 443
EXPOSE 22
RUN echo "@testing http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
&& apk add --update \
build-base alpine-sdk \
fuse fuse-dev \
automake autoconf \
libressl-dev \
curl-dev \
ca-certificates \
musl \
gcc \
libc-dev \
bash \
git \
gfortran \
lapack-dev \
libxml2-dev \
libxslt-dev \
jpeg-dev \
libxext \
libsm \
libxrender \
curl \
sed \
openssh \
supervisor \
&& rm /var/cache/apk/* \
&& mkdir /usr/local/source
#RUN apk add geos py-geos geos-dev \
# --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
#setup ssh
RUN echo 'root:odinlab' |chpasswd
RUN sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config \
&& sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config \
&& ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa \
&& ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa \
&& ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa \
&& ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t ed25519
ENV IAM_ROLE=none
ENV AWS_ACCESS_KEY_ID=value
ENV AWS_SECRET_ACCESS_KEY=value
ENV USE_S3_VOLUME=true
ENV S3_ENDPOINT=
ENV S3_BUCKET_ACL=private
ENV S3_BUCKET_NAME=none
ENV MOUNT_POINT=/usr/local/source/web-api/.vizierdb
ARG S3FS_VERSION=v1.82
RUN git clone https://github.com/s3fs-fuse/s3fs-fuse.git && \
cd s3fs-fuse \
git checkout tags/${S3FS_VERSION} && \
./autogen.sh && \
./configure --prefix=/usr && \
make && \
make install
RUN s3fs --version
#install python 2.7
#RUN echo "manylinux1_compatible = True" > /usr/lib/python2.7/_manylinux.py \
# && cd /usr/bin \
# && ln -sf easy_install-2.7 easy_install \
# && ln -sf python2.7 python \
# && ln -sf python2.7-config python-config \
# && ln -sf pip2.7 pip \
# && ln -sf /usr/include/locale.h /usr/include/xlocale.h
#install anaconda
#RUN curl -OsL "https://repo.continuum.io/archive/Anaconda2-5.1.0-Linux-x86_64.sh" \
# && /bin/bash Anaconda2-5.1.0-Linux-x86_64.sh -b -p /opt/conda \
# && rm Anaconda2-5.1.0-Linux-x86_64.sh \
# && echo 'export PATH=/opt/conda/bin:$PATH' >> /etc/profile.d/conda.sh
#install miniconda
RUN curl -OsL "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh" \
&& /bin/bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda \
&& rm Miniconda3-latest-Linux-x86_64.sh \
&& echo 'export PATH=/opt/conda/bin:$PATH' >> /etc/profile.d/conda.sh
#setup web-api
#copy local archive instead of pulling from github
#COPY web-api.tgz /usr/local/source/
#RUN tar -C /usr/local/source/ -zxvf /usr/local/source/web-api.tgz \
RUN cd /usr/local/source/ \
&& /opt/conda/bin/conda create --name vizierasync python=3.7 pip \
&& source /opt/conda/bin/activate vizierasync \
&& git clone https://$gituser:$gitpass@github.com/VizierDB/web-api-async.git web-api\
&& cd /usr/local/source/web-api \
&& git checkout -b local_$API_BRANCH origin/$API_BRANCH \
&& pip install -r requirements.txt \
&& pip install gunicorn \
&& pip install futures \
&& pip install matplotlib \
&& pip install bokeh \
&& pip install geopandas \
&& pip install pandas \
&& pip install numpy \
&& pip install shapely \
# && pip install git+https://github.com/matplotlib/basemap \
&& pip install -e . \
&& mkdir -p /usr/local/source/web-api/.vizierdb
ENV PULL_CODE=11
RUN cd /usr/local/source/web-api \
&& git pull
COPY run_init.sh /usr/local/source/run_init.sh
COPY run_web_api.sh /usr/local/source/run_web_api.sh
COPY entrypoint.sh /usr/local/source/entrypoint.sh
COPY supervisord.conf /etc/supervisord.conf
COPY wsgi_profiler_conf.py /usr/local/source/web-api/vizier/wsgi_profiler_conf.py
RUN chmod +x /usr/local/source/run_init.sh \
/usr/local/source/run_web_api.sh \
/usr/local/source/entrypoint.sh
ENTRYPOINT ["\/bin\/bash", "-c", "/usr/local/source/entrypoint.sh"]