Dockerfile 1.86 KB
Newer Older
1
# -*- coding: utf-8 -*-
2
3
4
5
#
# This file is part of CERN Search.
# Copyright (C) 2018-2019 CERN.
#
6
# Citadel Search is free software; you can redistribute it and/or modify it
7
# under the terms of the MIT License; see LICENSE file for more details.
8
9

# Use CentOS7:
Carina Antunes's avatar
Carina Antunes committed
10
FROM gitlab-registry.cern.ch/webservices/cern-search/cern-search-rest-api/cern-search-rest-api-base:bfdd86117598a031f427328c9d276f7f1b782520
11
ARG build_env
12

Carina Antunes's avatar
Carina Antunes committed
13
14
15
16
# Switch to base once issues with pipenv are fixed
RUN yum update -y && \
    yum install -y mailcap

17
# CERN Search installation
18
19
20
WORKDIR /${WORKING_DIR}/src
ADD . /${WORKING_DIR}/src

21
RUN pip freeze
22
# If env is development, install development dependencies
23
RUN if [ "$build_env" != "prod" ]; then pipenv install --system --ignore-pipfile --deploy --dev; fi
24

25
# Install CSaS
26
RUN pip install -e .
27
28
29
30
31
32

# PID File for uWSGI
RUN touch /${WORKING_DIR}/src/uwsgi.pid
RUN chmod 666 /${WORKING_DIR}/src/uwsgi.pid

# Patch auth
33
RUN sh /${WORKING_DIR}/src/scripts/patch/oauth_patch.sh
34

Carina Antunes's avatar
Carina Antunes committed
35
36
37
ENV LOGS_DIR=/var/log
RUN mkdir -p ${LOGS_DIR}
RUN chown -R invenio:root ${LOGS_DIR}
38

Carina Antunes's avatar
Carina Antunes committed
39
40
# Tika default logs dir
ENV TIKA_LOG_PATH=${LOGS_DIR}
41

Carina Antunes's avatar
Carina Antunes committed
42
43
# Install UI
USER invenio
44
45
46
RUN invenio collect -v
RUN invenio webpack buildall
# Move static files to instance folder
47
RUN cp /${WORKING_DIR}/src/static/images/cernsearchicon.png ${INVENIO_INSTANCE_PATH}/static/images/cernsearchicon.png
48
49

EXPOSE 5000
50

Pablo Panero's avatar
Oauth    
Pablo Panero committed
51
# uWSGI configuration
52
53
ARG UWSGI_WSGI_MODULE=cern_search_rest_api.wsgi:application
ENV UWSGI_WSGI_MODULE ${UWSGI_WSGI_MODULE:-cern_search_rest_api.wsgi:application}
Pablo Panero's avatar
Oauth    
Pablo Panero committed
54
55
56
57
58
59
60
ARG UWSGI_PORT=5000
ENV UWSGI_PORT ${UWSGI_PORT:-5000}
ARG UWSGI_PROCESSES=2
ENV UWSGI_PROCESSES ${UWSGI_PROCESSES:-2}
ARG UWSGI_THREADS=2
ENV UWSGI_THREADS ${UWSGI_THREADS:-2}

Carina Antunes's avatar
Carina Antunes committed
61
CMD ["/bin/bash", "-c", "uwsgi --module ${UWSGI_WSGI_MODULE} --socket 0.0.0.0:${UWSGI_PORT} --master --processes ${UWSGI_PROCESSES} --threads ${UWSGI_THREADS} --stats /tmp/stats.socket"]