Dockerfile 1.61 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:
10
FROM gitlab-registry.cern.ch/webservices/cern-search/cern-search-rest-api/cern-search-rest-api-base:9f21df59fb0015f4ec19b4521b4ef3bfb5ec54b2
11
ARG build_env
12
13

# CERN Search installation
14
15
16
WORKDIR /${WORKING_DIR}/src
ADD . /${WORKING_DIR}/src

17
# If env is development, install development dependencies
18
RUN if [ "$build_env" != "prod" ]; then pipenv install --system --ignore-pipfile --deploy --dev; fi
19

20
# Install CSaS
21
RUN pip install -e .
22
23
24
25
26
27

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

# Patch auth
28
RUN sh /${WORKING_DIR}/src/scripts/patch/oauth_patch.sh
29

30
# Install UI
31
USER invenio
32

33

34
35
36
RUN invenio collect -v
RUN invenio webpack buildall
# Move static files to instance folder
37
RUN cp /${WORKING_DIR}/src/static/images/cernsearchicon.png ${INVENIO_INSTANCE_PATH}/static/images/cernsearchicon.png
38
39

EXPOSE 5000
40

Pablo Panero's avatar
Oauth    
Pablo Panero committed
41
# uWSGI configuration
42
43
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
44
45
46
47
48
49
50
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
51
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"]