wallabag / wallabag

wallabag is a self hostable application for saving web pages: Save and classify articles. Read them later. Freely.

Home Page:https://wallabag.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

voltagex opened this issue · comments

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?

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

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)