ziishaned/opus

Problem installing in docker container

SalahAdDin opened this issue · 3 comments

I'm trying to make a Dockerfile for install it, i'm getting this error now:

Removing intermediate container 9981adb8e100
Step 12 : RUN composer install
 ---> Running in b878cfa19a0c
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for facebook/webdriver 1.4.0 -> satisfiable by facebook/webdriver[1.4.0].
    - facebook/webdriver 1.4.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
  Problem 2
    - facebook/webdriver 1.4.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - laravel/dusk v1.0.14 requires facebook/webdriver ~1.0 -> satisfiable by facebook/webdriver[1.4.0].
    - Installation request for laravel/dusk v1.0.14 -> satisfiable by laravel/dusk[v1.0.14].

  To enable extensions, verify that they are enabled in your .ini files:
    - 
    - /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
ERROR: Service 'master' failed to build: The command '/bin/sh -c composer install' returned a non-zero code: 2

This is my Dockerfile:

FROM php:7-fpm

RUN apt-get update > /dev/null \
    && apt-get install -yyq \
    git \
    curl \
    unzip \
    > /dev/null \
    && docker-php-ext-install \
    pdo_mysql \
    iconv \
    pdo \
    > /dev/null \
    && docker-php-ext-enable \
    pdo_mysql \
    iconv \
    pdo \
    > /dev/null \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
RUN php composer-setup.php
RUN php -r "unlink('composer-setup.php');"

RUN mv composer.phar /usr/local/bin/composer

WORKDIR ~
RUN git clone -q https://github.com/zeeshanu/opus.git opus
WORKDIR opus
ADD .env /opus/.env
# TODO: Make posible change branches before install
#active_version=$(git status | head -1)
#if [ "$active_version" != "HEAD detached at $version" ]; then
#    echo "Switching to version $version ..."
#    git fetch -q
#    git checkout -q $version
#fi

RUN composer install

@SalahAdDin You need to enable ext-zip php extension in your php.ini file.

Yes, i did it, it solve, but i have a new problem:

Step 13/15 : RUN php artisan migrate
 ---> Running in 2c6d7789faae
**************************************
*     Application In Production!     *
**************************************

Command Cancelled!
 ---> 60dee6200062
Removing intermediate container 2c6d7789faae
Step 14/15 : RUN php artisan key:generate
 ---> Running in e213da367195

                                                                               
  [ErrorException]                                                             
  file_get_contents(/var/www/html/~/opus/.env): failed to open stream: No suc  
  h file or directory 

I added the three final commands:

RUN php artisan migrate
RUN php artisan key:generate
RUN php artisan db:seed

What happen here?

Ok, i change the file and i get this error now:

 ---> Running in 865b1d47f86c

                                                                               
  [Illuminate\Database\QueryException]                                         
  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name o  
  r service not known (SQL: select * from information_schema.tables where tab  
  le_schema = opus and table_name = migrations)                                
                                                                               

                                                                               
  [Doctrine\DBAL\Driver\PDOException]                                          
  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name o  
  r service not known                                                          
                                                                               

                                                                               
  [PDOException]                                                               
  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name o  
  r service not known                                                          
                                                                               

                                                                               
  [PDOException]                                                               
  PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Name or s  
  ervice not known

The change was this:

WORKDIR /var/www/html/
RUN git clone -q https://github.com/zeeshanu/opus.git opus
WORKDIR opus
ADD conf/.env .env