Dockerfile 1.75 KB
Newer Older
1
# -*- coding: utf-8 -*-
2
3
#
# This file is part of CERN Search.
Carina Antunes's avatar
Carina Antunes committed
4
# Copyright (C) 2018-2021 CERN.
5
#
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:795c35db2e0302474454fde0ba453253c8916eef
11
ARG build_env
12
13

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

17
# Install CSaS
Carina Antunes's avatar
Carina Antunes committed
18
19
20
21
# If env is development, installs also development dependencies.
RUN if [ "$build_env" != "prod" ]; \
    then poetry install --no-root --no-interaction --no-ansi && python setup.py develop --no-deps; \
    else python setup.py install --no-deps; fi
22
23
24
25
26

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

Carina Antunes's avatar
Carina Antunes committed
27
28
29
ENV LOGS_DIR=/var/log
RUN mkdir -p ${LOGS_DIR}
RUN chown -R invenio:root ${LOGS_DIR}
30

Carina Antunes's avatar
Carina Antunes committed
31
32
# Tika default logs dir
ENV TIKA_LOG_PATH=${LOGS_DIR}
33

Carina Antunes's avatar
Carina Antunes committed
34
35
# Install UI
USER invenio
Carina Antunes's avatar
Carina Antunes committed
36
37

# Collect static files
38
RUN invenio collect -v
39
RUN cp /${WORKING_DIR}/src/static/images/cernsearchicon.png ${INVENIO_INSTANCE_PATH}/static/images/cernsearchicon.png
40

Carina Antunes's avatar
Carina Antunes committed
41
42
43
# Build assets
RUN invenio webpack buildall

44
EXPOSE 5000
45

Pablo Panero's avatar
Oauth    
Pablo Panero committed
46
# uWSGI configuration
47
48
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
49
50
51
52
53
54
55
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
56
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"]