mercredi 3 avril 2019

database folder is not getting copied during docker build - Laravel 5.8

I have a dockerfile that build Laravel 5.8

FROM alpine:3.8 as build_stage

RUN ls -al
COPY . /src
RUN apk --no-cache add \
php7 \
php7-fpm \
php7-pdo \
php7-mbstring \
php7-xml \
php7-openssl \
php7-json \
php7-phar \
php7-zip \
php7-dom \
php7-xmlwriter \
php7-tokenizer \
php7-fileinfo \
php7-session \
php7-zlib && \
php7 -r "copy('http://getcomposer.org/installer', 'composer-setup.php');" && \
php7 composer-setup.php --install-dir=/usr/bin --filename=composer && \
php7 -r "unlink('composer-setup.php');" && \
ln -sf /usr/bin/php7 /usr/bin/php && \
ln -s /etc/php7/php.ini /etc/php7/conf.d/php.ini
WORKDIR /src
RUN ls -al
RUN composer install


FROM alpine:3.8
RUN apk --no-cache add \
php7 \
php7-mbstring \
php7-session \
php7-openssl \
php7-tokenizer \
php7-json
COPY --from=build_stage /src  /src
RUN ls -al
RUN set -x \
addgroup -g 82 -S www-data \
adduser -u 82 -D -S -G www-data www-data
WORKDIR /src
RUN ls -al
RUN chmod -R 777 storage
CMD php artisan serve --host=0.0.0.0


I kept getting

Could not scan for classes inside "database/seeds" which does not appear to be a file nor a folder

⚡️  portal-modules  docker-compose up
Building portalmodules
Step 1/16 : FROM alpine:3.8 as build_stage
 ---> dac705114996
Step 2/16 : RUN ls -al
 ---> Using cache
 ---> d6ab0acce429
Step 3/16 : COPY . /src
 ---> 0760e33ce483
Step 4/16 : RUN apk --no-cache add php7 php7-fpm php7-pdo php7-mbstring php7-xml php7-openssl php7-json php7-phar php7-zip php7-dom php7-xmlwriter php7-tokenizer php7-fileinfo php7-session php7-zlib && php7 -r "copy('http://getcomposer.org/installer', 'composer-setup.php');" && php7 composer-setup.php --install-dir=/usr/bin --filename=composer && php7 -r "unlink('composer-setup.php');" && ln -sf /usr/bin/php7 /usr/bin/php && ln -s /etc/php7/php.ini /etc/php7/conf.d/php.ini
 ---> Running in 46bb452e58b9
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
(1/22) Installing php7-common (7.2.13-r0)
(2/22) Installing ncurses-terminfo-base (6.1_p20180818-r1)
(3/22) Installing ncurses-terminfo (6.1_p20180818-r1)
(4/22) Installing ncurses-libs (6.1_p20180818-r1)
(5/22) Installing libedit (20170329.3.1-r3)
(6/22) Installing pcre (8.42-r0)
(7/22) Installing libxml2 (2.9.8-r1)
(8/22) Installing php7 (7.2.13-r0)
(9/22) Installing php7-dom (7.2.13-r0)
(10/22) Installing php7-fileinfo (7.2.13-r0)
(11/22) Installing php7-fpm (7.2.13-r0)
(12/22) Installing php7-json (7.2.13-r0)
(13/22) Installing php7-mbstring (7.2.13-r0)
(14/22) Installing php7-openssl (7.2.13-r0)
(15/22) Installing php7-pdo (7.2.13-r0)
(16/22) Installing php7-phar (7.2.13-r0)
(17/22) Installing php7-session (7.2.13-r0)
(18/22) Installing php7-tokenizer (7.2.13-r0)
(19/22) Installing php7-xml (7.2.13-r0)
(20/22) Installing php7-xmlwriter (7.2.13-r0)
(21/22) Installing libzip (1.5.1-r1)
(22/22) Installing php7-zip (7.2.13-r0)
Executing busybox-1.28.4-r3.trigger
OK: 31 MiB in 35 packages
All settings correct for using Composer
Downloading...

Composer (version 1.8.4) successfully installed to: /usr/bin/composer
Use it: php /usr/bin/composer

Removing intermediate container 46bb452e58b9
 ---> ca62fdf50bf0
Step 5/16 : WORKDIR /src
 ---> Running in c44a8fd54719
Removing intermediate container c44a8fd54719
 ---> 98175868f929
Step 6/16 : RUN ls -al
 ---> Running in ba1760bdb5b9
total 460
drwxr-xr-x   12 root     root          4096 Apr  3 16:42 .
drwxr-xr-x    1 root     root          4096 Apr  3 16:42 ..
-rw-r--r--    1 root     root            10 Mar 28 15:53 .dockerignore
-rw-r--r--    1 root     root           148 Mar 28 15:53 .env
-rw-r--r--    1 root     root           148 Mar 28 15:53 .env.example
drwxr-xr-x    8 root     root          4096 Apr  2 18:30 .git
-rwxr-xr-x    1 root     root           150 Mar 28 15:53 .gitignore
-rw-r--r--    1 root     root           944 Apr  3 16:41 Dockerfile
drwxr-xr-x    6 root     root          4096 Mar 28 15:53 app
-rw-r--r--    1 root     root          1686 Mar 28 15:53 artisan
drwxr-xr-x    3 root     root          4096 Mar 28 15:53 bootstrap
-rw-r--r--    1 root     root          1550 Mar 28 15:53 composer.json
-rw-r--r--    1 root     root        158691 Mar 28 15:53 composer.lock
drwxr-xr-x    2 root     root          4096 Mar 28 15:53 config
-rw-r--r--    1 root     root           125 Mar 29 13:49 docker-compose.yml
-rw-r--r--    1 root     root          1125 Mar 28 15:53 package.json
-rw-r--r--    1 root     root          1156 Mar 28 15:53 phpunit.xml
drwxr-xr-x    4 root     root          4096 Mar 28 15:53 public
-rw-r--r--    1 root     root          6893 Apr  3 16:37 readme.md
drwxr-xr-x    6 root     root          4096 Mar 28 15:53 resources
drwxr-xr-x    2 root     root          4096 Mar 28 15:53 routes
-rw-r--r--    1 root     root           563 Mar 28 15:53 server.php
drwxrwxrwx    5 root     root          4096 Mar 28 15:53 storage
drwxr-xr-x    4 root     root          4096 Mar 28 15:53 tests
drwxr-xr-x   40 root     root          4096 Mar 28 15:53 vendor
-rw-r--r--    1 root     root           537 Mar 28 15:53 webpack.mix.js
-rw-r--r--    1 root     root        201012 Mar 28 15:53 yarn.lock
Removing intermediate container ba1760bdb5b9
 ---> 4f6eab2b635e
Step 7/16 : RUN composer install
 ---> Running in dbb6e283aae4
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating optimized autoload files


  [RuntimeException]                                                                                  
  Could not scan for classes inside "database/seeds" which does not appear to be a file nor a folder  


install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...

ERROR: Service 'portalmodules' failed to build: The command '/bin/sh -c composer install' returned a non-zero code: 1
⚡️  portal-modules  

I really have no idea why my database/ is not getting coppied over. As you can see, I did this line COPY . /src

This is my file structure locally


Questions

How would one go about and debug this further ?


I'm open to any suggestions at this moment.

Any hints/suggestions / helps on this be will be much appreciated!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire