docker/server/server.dockerfile
author ymh <ymh.work@gmail.com>
Mon, 29 Jul 2024 23:18:55 +0200
changeset 131 2a18dfe8bfc0
parent 130 5eeebcbdee22
permissions -rw-r--r--
last change before install
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 .
130
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    17
COPY docker/server/ivysettings.xml .
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    18
COPY virtualenv/res/src/django-extensions-0.8.tar.gz .
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    19
COPY virtualenv/res/src/django-piston-7c90898072ce-modifed.tar.gz .
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    20
COPY virtualenv/res/src/omab-django-social-auth-v0.3.10-modified.tar.gz .
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    21
COPY virtualenv/res/src/Django-1.4.tar.gz .
129
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
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
    24
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
    25
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
    26
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
    27
# 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
    28
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
RUN \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
 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 && \
130
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    32
 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 tar && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    33
 wget https://archive.apache.org/dist/lucene/pylucene/pylucene-3.6.2-1-src.tar.gz && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    34
 tar zxvf pylucene-3.6.2-1-src.tar.gz && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    35
 cd pylucene-3.6.2-1 && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    36
 pip install jcc && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    37
 #cd jcc && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    38
 #python setup.py install && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    39
 #cd .. && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    40
 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 --package java.util.function\nNUM_FILES=8\n/' Makefile && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    41
 sed -i 's/http:\/\/repo1\.maven\.org\/maven2/https:\/\/repo1.maven.org\/maven2/' lucene-java-3.6.2/lucene/common-build.xml && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    42
 sed -i 's/<property name="javac\.source" value="1\.5"\/>/<property name="javac\.source" value="1.6"\/>/' lucene-java-3.6.2/lucene/common-build.xml && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    43
 sed -i 's/<property name="javac\.target" value="1\.5"\/>/<property name="javac\.target" value="1.6"\/>/' lucene-java-3.6.2/lucene/common-build.xml && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    44
 sed -i 's/<property name="javac\.source\.backwards" value="1\.5"\/>/<property name="javac.source.backwards" value="1.6"\/>/' lucene-java-3.6.2/lucene/common-build.xml && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    45
 sed -i 's/<property name="javac\.target\.backwards" value="1\.5"\/>/<property name="javac.target.backwards" value="1.6"\/>/' lucene-java-3.6.2/lucene/common-build.xml && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    46
 make ivy && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    47
 sed -i 's/^<\/project>/  <ivy:settings file="\/code\/ivysettings.xml"\/>\n<\/project>/' lucene-java-3.6.2/lucene/common-build.xml && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    48
 patchelf --add-needed libjvm.so /opt/venv/lib/python2.7/site-packages/jcc/_jcc2.so && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    49
 patchelf --add-needed libjvm.so /opt/venv/lib/python2.7/site-packages/libjcc2.so && \
129
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
 make && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
 make install && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
 cd /code && \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
 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
    54
 tar zxvf V01.11.tar.gz && \
130
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    55
 #cd platform-V01.11/src/ldt && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    56
 #python setup.py sdist && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    57
 #pip install dist/ldt-1.11.tar.gz && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    58
 #cd /code && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    59
 tar zxvf Django-1.4.tar.gz --strip-components=1 Django-1.4/django && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    60
 tar zxvf django-extensions-0.8.tar.gz --strip-components=1 django-extensions-django-extensions-0f498ff/django_extensions && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    61
 tar zxvf django-piston-7c90898072ce-modifed.tar.gz --strip-components=1 jespern-django-piston-7c90898072ce/piston && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    62
 tar zxvf omab-django-social-auth-v0.3.10-modified.tar.gz --strip-components=1 omab-django-social-auth-db55201/social_auth && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    63
 pip install -r requirements.txt && \
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    64
 echo "DONE"
129
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
130
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    66
FROM docker.io/python:2.7-alpine as run_base
129
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 --from=builder /opt/venv /opt/venv
130
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    69
COPY --from=builder /code/django /code/django
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    70
COPY --from=builder /code/social_auth /code/social_auth
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    71
COPY --from=builder /code/platform-V01.11/src/ldt/ldt /code/ldt
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    72
COPY --from=builder /code/piston /code/piston
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
    73
COPY --from=builder /code/django_extensions /code/django_extensions
129
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
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
    75
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
ENV BASEDIR="/code"
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
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
    78
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
WORKDIR $BASEDIR
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
RUN \
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
  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
    83
  mkdir -p /static
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
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
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
    87
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
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
    89
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
    90
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
ENV PYTHONPATH "/code/"
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
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
    93
ENV DEBUG "False"
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
ENV DATABASE_URL ""
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
ENV DJANGO_SECRET ""
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
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
    98
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
    99
130
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
   100
FROM run_base as prod
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
   101
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
   102
COPY web/tralalere /code/tralalere
5eeebcbdee22 use right version for lucene and make players work again
ymh <ymh.work@gmail.com>
parents: 129
diff changeset
   103
129
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
EXPOSE 8000
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
   105
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
ENTRYPOINT ["/entrypoint.sh"]
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
f6b392c37e10 lucene 7.7.1 compiled but not compatible with ldt indexation
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
# # 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
   109
CMD [ "/opt/venv/bin/uwsgi", "--yaml", "/code/tralalere.yml"]