Commit 5b71acdc authored by Pablo Panero's avatar Pablo Panero
Browse files

docker: update Dockerfile to use invenio base image

parent b0ad64d9
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Use CentOS7: # Use CentOS7:
FROM cern/cc7-base FROM gitlab-registry.cern.ch/webservices/cern-search/cern-search-rest-api/invenio:py36
ARG build_devel ARG build_devel
ENV DEVEL=$build_devel ENV DEVEL=$build_devel
# Install pre-requisites # Install pre-requisites
RUN yum update -y && \ RUN yum update -y && \
yum install -y epel-release && \
yum install -y \ yum install -y \
python-devel \
python-pip \
gcc \ gcc \
openssl \ openssl \
npm \ openldap-devel
openldap-devel && \
pip install --upgrade pip setuptools wheel # Change to user invenio to install the instance
USER invenio
# CERN Search installation # CERN Search installation
WORKDIR /code WORKDIR /${WORKING_DIR}/src
ADD . /code ADD . /${WORKING_DIR}/src
ENV INVENIO_INSTANCE_PATH=/usr/local/var/cernsearch/var/cernsearch-instance RUN if [ -n "${DEVEL-}" ]; then pipenv install -r requirements-devel.txt; else pipenv install -r requirements.txt; fi
ENV LOGO_PATH=/images/cernsearchicon.png
RUN pipenv install -e .[all,postgresql,elasticsearch6]
RUN chmod g=u /etc/passwd && \
chmod +x /code/scripts/*.sh && \ RUN pipenv run invenio collect -v
sh /code/scripts/create-instance.sh && \ RUN pipenv run invenio webpack buildall
sh /code/scripts/gen-cert.sh && \ RUN mv /${WORKING_DIR}/src/static/images/cernsearchicon.png ${INVENIO_INSTANCE_PATH}/static/images/cernsearchicon.png
chmod +x /code/scripts/patch/oauth_patch.sh && \
sh /code/scripts/patch/oauth_patch.sh && \ # PID File for uWSGI
mv nginx.crt nginx.key ${INVENIO_INSTANCE_PATH} && \ RUN touch /${WORKING_DIR}/src/uwsgi.pid
chgrp -R 0 ${INVENIO_INSTANCE_PATH} && \ RUN chmod 666 /${WORKING_DIR}/src/uwsgi.pid
chmod -R g=u ${INVENIO_INSTANCE_PATH} &&\
adduser --uid 1000 invenio --gid 0 && \ # Patch auth
chown -R invenio:root /code USER root
RUN chmod +x /${WORKING_DIR}/src/scripts/patch/oauth_patch.sh
USER invenio
RUN sh /${WORKING_DIR}/src/scripts/patch/oauth_patch.sh
# uWSGI configuration # uWSGI configuration
ARG UWSGI_WSGI_MODULE=cern_search_rest_api.wsgi:application ARG UWSGI_WSGI_MODULE=cern_search_rest_api.wsgi:application
...@@ -46,8 +48,8 @@ ENV UWSGI_PROCESSES ${UWSGI_PROCESSES:-2} ...@@ -46,8 +48,8 @@ ENV UWSGI_PROCESSES ${UWSGI_PROCESSES:-2}
ARG UWSGI_THREADS=2 ARG UWSGI_THREADS=2
ENV UWSGI_THREADS ${UWSGI_THREADS:-2} ENV UWSGI_THREADS ${UWSGI_THREADS:-2}
USER 1000
EXPOSE 5000 EXPOSE 5000
CMD ["/bin/sh", "-c", "/code/scripts/manage-user.sh && uwsgi --module ${UWSGI_WSGI_MODULE} --socket 0.0.0.0:${UWSGI_PORT} --master --processes ${UWSGI_PROCESSES} --threads ${UWSGI_THREADS} --stats /tmp/stats.socket"] CMD ["/bin/sh", "-c", "/${WORKING_DIR}/src/scripts/manage-user.sh && uwsgi --module ${UWSGI_WSGI_MODULE} --socket 0.0.0.0:${UWSGI_PORT} --master --processes ${UWSGI_PROCESSES} --threads ${UWSGI_THREADS} --stats /tmp/stats.socket"]
\ No newline at end of file \ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment