Skip to content
Snippets Groups Projects
Dockerfile 1.6 KiB
Newer Older
  • Learn to ignore specific revisions
  • # SPDX-FileCopyrightText: 2022 Georg-August-Universität Göttingen
    
    #
    # SPDX-License-Identifier: CC0-1.0
    
    
    # syntax=docker/dockerfile:1
    
    FROM python:3.8-alpine as builder
    
    # build icu lib
    # hadolint ignore=DL3018
    RUN apk add --no-cache g++ icu-dev \
        && pip install --no-cache-dir PyICU==2.8.1
    
    
    
    FROM python:3.8-alpine
    
    LABEL \
        org.label-schema.dockerfile="/Dockerfile" \
        org.label-schema.license="AGPL-3.0-or-later" \
        org.label-schema.maintainer="Stefan Hynek" \
        org.label-schema.name="Textgrid Repository WebDAV Server" \
        org.label-schema.schema-version="1.0" \
        org.label-schema.url="https://gitlab.gwdg.de/dariah-de/textgridrep/repdav" \
        org.label-schema.vcs-url="https://gitlab.gwdg.de/dariah-de/textgridrep/repdav" \
        org.label-schema.vendor="SUB/FE"
    
    
    # copy pre-compiled icu lib from builder stage
    COPY --from=builder /usr/local/lib/python3.8/site-packages/icu /usr/local/lib/python3.8/site-packages/icu
    COPY --from=builder /usr/local/lib/python3.8/site-packages/PyICU-2.8.1.dist-info /usr/local/lib/python3.8/site-packages/PyICU-2.8.1.dist-info
    
    # icu-dev package is nevertheless needed by the python library
    
    # hadolint ignore=DL3018
    
    USER repdav
    
    COPY --chown=repdav requirements.txt /
    RUN pip install \
        --no-cache-dir \
        --requirement requirements.txt \
        --user
    
    
    COPY --chown=repdav src/ .
    
    ARG build_date
    ARG vcs_ref
    ARG version
    LABEL \
        org.label-schema.build-date="${build_date}" \
        org.label-schema.vcs-ref="${vcs_ref}" \
        org.label-schema.version="${version}"
    
    
    CMD ["python", "main.py"]