do-community / hacktober-board

Hacktoberfest Board
http://hacktober-board.com
6 stars 9 forks source link

Issues running docker-compose up #31

Closed BBBThunda closed 4 years ago

BBBThunda commented 4 years ago

When running docker-compose up I got a few issues (after working around each issue). Can I post a PR with my proposed fixes?

My fixes are focused on making it work in dev environments to enable contributions, so I wanted to check first in case you are somehow using the docker container to deploy to production or something.

Step 12/16 : RUN /usr/local/bin/composer install
 ---> Running in e16d690379b5
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 84 installs, 0 updates, 0 removals

  [RuntimeException]
  /var/www/vendor does not exist and could not be created.

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 'app' failed to build: The command '/bin/sh -c /usr/local/bin/composer install' returned a non-zero code: 1

Then, after implementing a workaround (adding chown step in Dockerfile), I got this:

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 84 installs, 0 updates, 0 removals
    Failed to download doctrine/inflector from dist: The zip extension and unzip command are both missing, skipping.
Your command-line PHP is using multiple ini files. Run `php --ini` to show them.
    Now trying to download from source
  - Installing doctrine/inflector (v1.3.0): Cloning 5527a48b73 from cache
    Failed to download doctrine/lexer from dist: The zip extension and unzip command are both missing, skipping.
Your command-line PHP is using multiple ini files. Run `php --ini` to show them.

Then after adding those to the Dockerfile, artisan was complaining because I didn't have a .env file. You have .env in your .dockerignore so I added a Dockerfile step that copies .env.example to .env inside the container.

Then loading the page in the browser was resulting in errors because it couldn't find the autoload.php file. Turns out mounting the project root in docker-compose.yml was causing the vendor/ directory in the container to get overwritten.

So I made a change to docker-compose.yml.

Then I did a

docker-compose build
docker-compose up

Followed by your DB initialization steps from README.md and now I have a working dev site. Hacktober-Board_2019_-_Hacktobefest_Issues_Board

BBBThunda commented 4 years ago

Never mind - took longer than I expected to post this issue so I just created PR 32 for this. https://github.com/erikaheidi/hacktober-board/pull/32

Feel free to pick it apart if you like :)