dev/hdalab/Dockerfile
author ymh <ymh.work@gmail.com>
Fri, 16 Mar 2018 12:29:12 +0100
changeset 687 53fee689f666
parent 686 385e3a12ee27
permissions -rw-r--r--
Dockerfile correction and add a way to save/load the docker images.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
686
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
FROM python:2.7-alpine
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
ENV PHANTOMJS_ARCHIVE="phantomjs.tar.gz"
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
ENV REDLAND_ARCHIVE="redland-bindings-1.0.17.1"
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
RUN echo '@edge http://nl.alpinelinux.org/alpine/edge/main'>> /etc/apk/repositories \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 && apk update \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
 && apk add --upgrade apk-tools@edge \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
 && apk add --no-cache --virtual build-deps gcc python-dev musl-dev linux-headers postgresql-dev \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
 && apk add --no-cache supervisor curl bash \
687
53fee689f666 Dockerfile correction and add a way to save/load the docker images.
ymh <ymh.work@gmail.com>
parents: 686
diff changeset
    11
 && apk add --no-cache libxml2 libxslt postgresql-client \
686
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
 && apk add --no-cache --virtual build-deps libxml2-dev \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
 && apk add --no-cache --virtual build-deps libxslt-dev \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
 && apk add --no-cache unixodbc raptor2 rasqal redland \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
 && apk add --no-cache --virtual build-deps sqlite-dev libtool make automake autoconf swig raptor2-dev rasqal-dev redland-dev \
687
53fee689f666 Dockerfile correction and add a way to save/load the docker images.
ymh <ymh.work@gmail.com>
parents: 686
diff changeset
    16
 && apk add --no-cache jpeg zlib freetype lcms2 openjpeg tiff tk tcl harfbuzz fribidi sqlite \
686
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
 && apk add --no-cache --virtual build-deps jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev harfbuzz-dev fribidi-dev \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
 && mkdir -p /usr/include/libxml \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
 && ln -s /usr/include/libxml2/libxml/xmlexports.h /usr/include/libxml/xmlexports.h \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
 && ln -s /usr/include/libxml2/libxml/xmlversion.h /usr/include/libxml/xmlversion.h \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
 && addgroup -S www && adduser -S -G www www \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
 && mkdir /etc/supervisord.d \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
 && mkdir -p /tmp/build-tmp \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
 && mkdir -p /var/lib/hdalab \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
 && mkdir -p /var/log/hdalab \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
 && mkdir -p /etc/hdalab \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
 && mkdir -p /etc/uwsgi \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
 && chown -R www:www /var/log/hdalab \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
 && chown -R www:www /var/lib/hdalab \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
 && mkdir /usr/local/sbin
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
COPY entrypoint.sh /usr/local/sbin/entrypoint.sh
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
COPY dist/renkanmanager.tar.gz /tmp/build-tmp
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
COPY dist/hdalab.tar.gz /tmp/build-tmp
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
COPY dist/base_requirements.txt /tmp/build-tmp
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
COPY srvr_requirements.txt /tmp/build-tmp
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
COPY settings.py /etc/hdalab/hdalab_settings.py
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
COPY supervisord.conf /etc/supervisord.conf
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
COPY supervisor.d/hdalab.ini /etc/supervisor.d/
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
COPY supervisor.d/celeryd-hdalab.ini /etc/supervisor.d/
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
COPY supervisor.d/celerybeat-hdalab.ini /etc/supervisor.d/
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
COPY uwsgi/hdalab.yml /etc/uwsgi/hdalab.yml
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
COPY dist/data /etc/hdalab/data
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
COPY import_hda_rdf.sh /usr/local/sbin/import_hda_rdf.sh
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
COPY renkan_default_icon.png /etc/hdalab/
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
RUN pip install --no-cache-dir -r /tmp/build-tmp/base_requirements.txt \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
 && pip install --no-cache-dir -r /tmp/build-tmp/srvr_requirements.txt \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
 && pip install /tmp/build-tmp/renkanmanager.tar.gz \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
 && pip install /tmp/build-tmp/hdalab.tar.gz \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
 && curl -Lk -o /tmp/build-tmp/$REDLAND_ARCHIVE.tar.gz http://download.librdf.org/source/$REDLAND_ARCHIVE.tar.gz \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
 && tar -xf /tmp/build-tmp/$REDLAND_ARCHIVE.tar.gz -C /tmp/build-tmp/
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
WORKDIR /tmp/build-tmp/${REDLAND_ARCHIVE}
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
RUN ./autogen.sh \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
 && cd python \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
 && make \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
 && make install
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
WORKDIR /
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
RUN rm -fr /tmp/build-tmp \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
 && chmod +x /usr/local/sbin/import_hda_rdf.sh /usr/local/sbin/entrypoint.sh \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
 && curl -Lk -o $PHANTOMJS_ARCHIVE https://github.com/fgrehm/docker-phantomjs2/releases/download/v2.0.0-20150722/dockerized-phantomjs.tar.gz \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
 && tar -xf $PHANTOMJS_ARCHIVE -C /tmp/ \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
 && cp -R /tmp/etc/fonts /etc/ \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
 && cp -R /tmp/lib/* /lib/ \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
 && cp -R /tmp/lib64 / \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
 && cp -R /tmp/usr/lib/* /usr/lib/ \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
 && cp -R /tmp/usr/lib/x86_64-linux-gnu /usr/ \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
 && cp -R /tmp/usr/share/* /usr/share/ \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
 && cp /tmp/usr/local/bin/phantomjs /usr/bin/ \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
 && rm -fr $PHANTOMJS_ARCHIVE  /tmp/* \
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
 && apk del build-deps
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
ENV PYTHONPATH="/etc/hdalab"
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
ENV DJANGO_SETTINGS_MODULE=hdalab_settings
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
385e3a12ee27 Containerization and various corrections to make it work
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
CMD ["/bin/sh", "/usr/local/sbin/entrypoint.sh"]