matiasdelellis / pdlib

PHP extension for Dlib.
MIT License
2 stars 2 forks source link

Cannot Build Docker #3

Open jiatao99 opened 4 years ago

jiatao99 commented 4 years ago

Followed your Wiki to build the docker. Got 2 errors

  1. Copy error at step 13.
    Step 13/19 : COPY --from=builder /usr/local/lib/libdlib.so* /usr/local/lib
    When using COPY with more than one source file, the destination must be a directory and end with a /

Fixed by adding trailing /

COPY --from=builder /usr/local/lib/libdlib.so* /usr/local/lib/
  1. I have NO idea how to fix this one:
    Step 14/19 : COPY --from=builder /usr/local/lib/php/extensions/no-debug-non-zts-20180731/pdlib.so /usr/local/lib/php/extensions/no-debug-non-zts-20180731/
    COPY failed: stat /docker/storage/overlay2/22e778c041f5119a410ad4e166b3b8ac24b0668edad77efadf80b18f5be25f9d/merged/usr/local/lib/php/extensions/no-debug-non-zts-20180731/pdlib.so: no such file or directory
Axolord commented 4 years ago

same for me

nandokawka commented 4 years ago

The build has a different date. You need to change the date in the Dockerfile. COPY --from=builder /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pdlib.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/

tounefr commented 4 years ago

Here my working Dockerfile

FROM nextcloud:apache as builder

# Build and install dlib on builder

RUN apt-get update ; \
    apt-get install -y build-essential wget cmake libx11-dev libopenblas-dev

ARG DLIB_BRANCH=v19.19
RUN wget -c -q https://github.com/davisking/dlib/archive/$DLIB_BRANCH.tar.gz \
    && tar xf $DLIB_BRANCH.tar.gz \
    && mv dlib-* dlib \
    && cd dlib/dlib \
    && mkdir build \
    && cd build \
    && cmake -DBUILD_SHARED_LIBS=ON --config Release .. \
    && make \
    && make install

# Build and install PDLib on builder

ARG PDLIB_BRANCH=master
RUN apt-get install unzip
RUN wget -c -q https://github.com/matiasdelellis/pdlib/archive/$PDLIB_BRANCH.zip                                                                                                                                \
    && unzip $PDLIB_BRANCH \
    && mv pdlib-* pdlib \
    && cd pdlib \
    && phpize \
    && ./configure \
    && make \
    && make install

# Enable PDlib on builder

# If necesary take the php settings folder uncommenting the next line
# RUN php -i | grep "Scan this dir for additional .ini files"
RUN echo "extension=pdlib.so" > /usr/local/etc/php/conf.d/pdlib.ini

# Test PDlib instalation on builer

RUN apt-get install -y git
RUN git clone https://github.com/matiasdelellis/pdlib-min-test-suite.git \
    && cd pdlib-min-test-suite \
    && make

#
# If pass the tests, we are able to create the final image.
#

FROM nextcloud:apache

# Install dependencies to image

RUN apt-get update ; \
    apt-get install -y libopenblas-base

# Install dlib and PDlib to image

COPY --from=builder /usr/local/lib/libdlib.so* /usr/local/lib/

# If is necesary take the php extention folder uncommenting the next line
# RUN php -i | grep extension_dir
COPY --from=builder /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pdli                                                                                                                               b.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/

# Enable PDlib on final image

RUN echo "extension=pdlib.so" > /usr/local/etc/php/conf.d/pdlib.ini

# Increse memory limits

RUN echo memory_limit=1024M > /usr/local/etc/php/conf.d/memory-limit.ini

# Pdlib is already installed, now without all build dependencies.
# You could test again if everything is correct, uncommenting the next lines
#
# RUN apt-get install -y git wget
# RUN git clone https://github.com/matiasdelellis/pdlib-min-test-suite.git \
#    && cd pdlib-min-test-suite \
#    && make

#
# At this point you meet all the dependencies to install the application
# If is available you can skip this step and install the application from the ap                                                                                                                               plication store
#
ARG FR_BRANCH=master
RUN apt-get install -y wget unzip nodejs npm
RUN wget -c -q -O facerecognition https://github.com/matiasdelellis/facerecognit                                                                                                                               ion/archive/$FR_BRANCH.zip \
  && unzip facerecognition \
  && mv facerecognition-*  /usr/src/nextcloud/facerecognition \
  && cd /usr/src/nextcloud/facerecognition \
  && make

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libbz2-dev && \
    docker-php-ext-install bz2