docker/server/server.dockerfile
changeset 0 2a447b707b65
equal deleted inserted replaced
-1:000000000000 0:2a447b707b65
       
     1 # set base image (host OS)
       
     2 FROM docker.io/python:2.7-alpine as builder
       
     3 
       
     4 ENV VIRTUALENV=/opt/venv
       
     5 
       
     6 # set the working directory in the container
       
     7 WORKDIR /code
       
     8 
       
     9 RUN \
       
    10     pip install virtualenv && \
       
    11     virtualenv $VIRTUALENV
       
    12 
       
    13 ENV PATH="$VIRTUALENV/bin:$PATH"
       
    14 
       
    15 # copy the dependencies file to the working directory
       
    16 COPY docker/server/requirements.txt .
       
    17 
       
    18 
       
    19 RUN \
       
    20  apk add --no-cache postgresql-client postgresql-libs libxml2 libxslt && \
       
    21  apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev libxml2-dev libxslt-dev linux-headers && \
       
    22  pip install -r requirements.txt
       
    23 
       
    24 COPY hashcut ./hashcut
       
    25 COPY metadatacomposer ./metadatacomposer
       
    26 COPY platform ./platform
       
    27 
       
    28 RUN \
       
    29   cd /code/platform/src/ldt && python setup.py sdist && pip install --no-binary ":all:" dist/*.tar.gz && \
       
    30   cd /code/hashcut/src && python setup.py sdist && pip install --no-binary ":all:" dist/*.tar.gz && \
       
    31   cd /code/metadatacomposer/src && python setup.py sdist && pip install --no-binary ":all:" dist/*.tar.gz
       
    32 
       
    33 
       
    34 FROM docker.io/python:2.7-alpine 
       
    35 
       
    36 COPY --from=builder /opt/venv /opt/venv
       
    37 
       
    38 WORKDIR /code
       
    39 
       
    40 ENV PATH="/opt/venv/bin:/code:$PATH"
       
    41 
       
    42 RUN \
       
    43  apk add --no-cache postgresql-client postgresql-libs libxml2 libxslt bash && \
       
    44  mkdir -p /static /iridata/www/ldt/web/static/media /run/log 
       
    45 
       
    46 COPY platform_web/src ./platform_web
       
    47 COPY docker/server/config.py ./platform_web/ldtplatform/
       
    48 
       
    49 COPY docker/server/platform.yml .
       
    50 COPY --chmod=0755 docker/server/entrypoint.sh .
       
    51 
       
    52 ENV PYTHONPATH "/code/platform_web"
       
    53 ENV DJANGO_SETTINGS_MODULE ldtplatform.settings
       
    54 ENV DEBUG "False"
       
    55 ENV DATABASE_URL ""
       
    56 ENV ES_HOST "es"
       
    57 ENV LDT_SECRET ""
       
    58 
       
    59 EXPOSE 8000
       
    60 
       
    61 ENTRYPOINT ["entrypoint.sh"]
       
    62 
       
    63 # command to run on container start
       
    64 CMD [ "/opt/venv/bin/uwsgi", "--yaml", "/code/platform.yml"]