docker/server/server.dockerfile
author ymh <ymh.work@gmail.com>
Tue, 23 Jul 2024 23:18:21 +0200
changeset 129 f6b392c37e10
child 130 5eeebcbdee22
permissions -rw-r--r--
lucene 7.7.1 compiled but not compatible with ldt indexation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
129
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
# set base image (host OS)
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
FROM docker.io/python:2.7-alpine as builder
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
ENV VIRTUALENV=/opt/venv
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
# set the working directory in the container
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
WORKDIR /code
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
RUN \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
    pip install virtualenv && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
    virtualenv $VIRTUALENV
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
ENV PATH="$VIRTUALENV/bin:$PATH"
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
# copy the dependencies file to the working directory
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
COPY docker/server/requirements.txt .
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
ENV JCC_JDK=/usr/lib/jvm/java-11-openjdk
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
ENV JCC_LFLAGS="-L/usr/lib/jvm/java-11-openjdk/jre/lib -ljava -L/usr/lib/jvm/java-11-openjdk/jre/lib/server -ljvm"
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
ENV PATH="/usr/lib/jvm/java-11-openjdk/jre/bin:$PATH"
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
ENV LD_LIBRARY_PATH="/usr/lib/jvm/java-11-openjdk/jre/lib:/usr/lib/jvm/java-11-openjdk/jre/lib/server"
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
# ENV JCC_LFLAGS=-L/usr/lib/jvm/java-8-openjdk/jre/lib/amd64
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
RUN \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
 apk add --no-cache postgresql-client postgresql-libs libxml2 libxslt libmemcached openjdk11 apache-ant bash jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
 apk add --no-cache --virtual .build-deps build-base postgresql-dev libxml2-dev libxslt-dev linux-headers sed wget patchelf git jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
 wget https://dlcdn.apache.org/lucene/pylucene/pylucene-7.7.1-src.tar.gz && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
 tar zxvf pylucene-7.7.1-src.tar.gz && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
 cd pylucene-7.7.1 && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
 cd jcc && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
 python setup.py install && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
 cd .. && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
 sed -i '1s/^/PREFIX_PYTHON=\/opt\/venv\nANT=JAVA_HOME=\/usr\/lib\/jvm\/java-11-openjdk \/usr\/bin\/ant\nPYTHON=$(PREFIX_PYTHON)\/bin\/python\nJCC=$(PYTHON) -m jcc --shared\nNUM_FILES=8\n/' Makefile && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
 sed -i 's/http:\/\/repo1\.maven\.org\/maven2/https:\/\/repo1.maven.org\/maven2/' lucene-java-7.7.1/lucene/common-build.xml && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
 patchelf --add-needed libjvm.so /opt/venv/lib/python2.7/site-packages/JCC-3.5-py2.7-linux-x86_64.egg/jcc/_jcc2.so && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
 patchelf --add-needed libjvm.so /opt/venv/lib/python2.7/site-packages/JCC-3.5-py2.7-linux-x86_64.egg/libjcc2.so && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
 make && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
 make install && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
 cd /code && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
 wget https://hg.dev.iri-research.org/platform/archive/V01.11.tar.gz && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
 tar zxvf V01.11.tar.gz && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
 cd platform-V01.11/src/ldt && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
 python setup.py sdist && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
 pip install dist/ldt-1.11.tar.gz && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
 cd /code && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
 pip install -r requirements.txt
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
FROM docker.io/python:2.7-alpine 
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
COPY --from=builder /opt/venv /opt/venv
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
COPY web/tralalere /code/tralalere
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
COPY web/manage.py /code/
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
ENV BASEDIR="/code"
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
ENV PATH="/opt/venv/bin:$BASEDIR:$PATH"
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
WORKDIR $BASEDIR
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
RUN \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
  apk add --no-cache postgresql-client postgresql-libs libxml2 libxslt libmemcached openjdk11 apache-ant bash jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev bash && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
  mkdir -p /static
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
COPY docker/server/config.py ./tralalere/
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
COPY docker/server/tralalere.yml .
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
COPY --chmod=0755 docker/server/entrypoint.sh /
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
ENV PYTHONPATH "/code/"
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
ENV DJANGO_SETTINGS_MODULE tralalere.settings
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
ENV DEBUG "False"
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
ENV DATABASE_URL ""
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
ENV DJANGO_SECRET ""
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
ENV PATH="/usr/lib/jvm/java-11-openjdk/jre/bin:$PATH"
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
ENV LD_LIBRARY_PATH="/usr/lib/jvm/java-11-openjdk/jre/lib:/usr/lib/jvm/java-11-openjdk/jre/lib/server"
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
EXPOSE 8000
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
ENTRYPOINT ["/entrypoint.sh"]
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
# # command to run on container start
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
CMD [ "/opt/venv/bin/uwsgi", "--yaml", "/code/tralalere.yml"]