Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local development: unable to run docker-compose.yml directly from git repo #7463

Open
voltagex opened this issue May 4, 2024 · 2 comments
Open
Assignees

Comments

@voltagex
Copy link

voltagex commented May 4, 2024

Version: fb87aec
Installation: git clone
PHP version: The version of PHP you are using
OS: Debian testing / Docker version 25.0.0, build e758fe5

Environment

N/A, this is a development environment issue

What steps will reproduce the bug?

A comment in docker-compose.yml says to # Copy docker/php/env.example to docker/php/env and customize however I needed to also cp docker/php/env .env.local

docker compose up spends some time building extensions, then the php container exits with the following error

php-1        | Warning: require(/var/www/html/bin/../vendor/autoload.php): Failed to open stream: No such file or directory in /var/www/html/bin/console on line 15
php-1        |
php-1        | Call Stack:
php-1        |     0.0000     677000   1. {main}() /var/www/html/bin/console:0
php-1        |
php-1        |
php-1        | Fatal error: Uncaught Error: Failed opening required '/var/www/html/bin/../vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /var/www/html/bin/console on line 15
php-1        |
php-1        | Error: Failed opening required '/var/www/html/bin/../vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /var/www/html/bin/console on line 15
php-1        |
php-1        | Call Stack:
php-1        |     0.0000     677000   1. {main}() /var/www/html/bin/console:0
php-1        |
php-1 exited with code 255
blackfire-1  | 04/05 12:11:07 ERR The Blackfire API https://blackfire.io/agent-api/v3/routes rejected the credentials (CHANGE_ME:CHANG...)
blackfire-1  | 04/05 12:11:07 ERR Cannot update the remote configuration (CHANGE_ME:CHANG...) error="The Blackfire API rejected your credentials."

The weird thing is this also happens if I try to install in a "blank" Docker container if I'm missing extensions - but shouldn't the docker-compose.yml and associated Dockerfiles be taking care of this?

@voltagex
Copy link
Author

voltagex commented May 4, 2024

You need to be able to run composer, but the way the docker-compose.yml is set up I don't think it'd ever work?

diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile
index 44c923e21..01bdb0c90 100644
--- a/docker/php/Dockerfile
+++ b/docker/php/Dockerfile
@@ -80,8 +80,10 @@ RUN npm install -g yarn
 RUN curl -L -o /usr/local/bin/envsubst https://github.com/a8m/envsubst/releases/download/v1.1.0/envsubst-`uname -s`-`uname -m`; \
     chmod +x /usr/local/bin/envsubst

+COPY ./composer.json .
 COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
-
+ENV COMPOSER_ALLOW_SUPERUSER=1
+RUN composer install --no-dev -o --prefer-dist
 COPY entrypoint.sh /entrypoint.sh
 COPY config/ /opt/wallabag/config/

Gets further, but because docker compose isn't working on a full copy of the Wallabag source, it errors out like

#20 24.31 Generating optimized autoload files
#20 24.31
#20 24.31 In ClassMapGenerator.php line 129:
#20 24.31
#20 24.31   Could not scan for classes inside "app/AppKernel.php" which does not appear
#20 24.31    to be a file nor a folder

@voltagex
Copy link
Author

voltagex commented May 4, 2024

At the time of writing, this works for a "fast" local setup

FROM debian:testing
WORKDIR /src
RUN apt update && apt install make curl php-cli php-mbstring  php-xml php-gd php-bcmath php-iconv php-intl php-pdo-sqlite php-mbstring php-intl php-opcache php-sockets php-tidy php-zip php-curl git unzip -y

COPY wallabag /src/wallabag
WORKDIR /src/wallabag

RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && apt install -y nodejs
RUN npm install -g yarn
RUN yarn install && yarn build:dev

ENV COMPOSER_ALLOW_SUPERUSER=1
RUN curl -sS https://getcomposer.org/installer -o composer-setup.php
RUN php composer-setup.php --install-dir=/usr/local/bin --filename=composer
RUN composer install

RUN php bin/console wallabag:install
RUN php bin/console assets:install

The official Dockerfile uses envsubst, however I don't see where the template for envsubst is stored. Therefore you'll need to hack parameters.yml to have the correct domain name (it'd be nice if this could be directly overridden via environment variable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants