Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
.vscode
node_modules
npm-debug.log
yarn.lock
composer.phar
var/cache
var/logs
var/log
var/sessions
.env
Dockerfile*
docker-compose*.yml
**/.DS_Store
**/Thumbs.db
vendor/
public/build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
/public/
/var/
/vendor/
/node_modules/
.DS_Store
.vagrant
.phpunit.result.cache
13 changes: 11 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git unzip libzip-dev libicu-dev libpng-dev libonig-dev libxml2-dev \
libc-client2007e-dev libkrb5-dev libssl-dev libpq-dev \
libfreetype6-dev libjpeg62-turbo-dev \
&& docker-php-ext-configure intl \
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j"$(nproc)" \
pdo pdo_mysql pdo_pgsql zip intl imap \
pdo pdo_mysql pdo_pgsql zip intl imap gd \
&& rm -rf /var/lib/apt/lists/*

RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt install -y nodejs \
&& npm install -g yarn
Comment on lines +22 to +24
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use apt-get instead of apt, and clean up apt lists in the same layer.

Two issues in this RUN block:

  1. Line 23 uses apt installapt is designed for interactive terminal use and is explicitly documented as having an unstable CLI interface not suitable for scripts. Use apt-get consistently with the rest of the Dockerfile.
  2. No rm -rf /var/lib/apt/lists/* at the end of this layer, inflating the image size with package index data.
🔧 Proposed fix
 RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
-    && apt install -y nodejs \
-    && npm install -g yarn
+    && apt-get install -y --no-install-recommends nodejs \
+    && npm install -g yarn \
+    && rm -rf /var/lib/apt/lists/*
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt install -y nodejs \
&& npm install -g yarn
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& npm install -g yarn \
&& rm -rf /var/lib/apt/lists/*
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Dockerfile` around lines 22 - 24, The RUN layer that installs Node (`RUN curl
-fsSL https://deb.nodesource.com/setup_20.x | bash - \ && apt install -y nodejs
\ && npm install -g yarn`) should use apt-get (not apt) and remove APT lists in
the same layer to avoid larger images: change `apt install -y nodejs` to
`apt-get update && apt-get install -y --no-install-recommends nodejs` (keep the
curl setup step), then chain `&& rm -rf /var/lib/apt/lists/*` at the end of that
RUN; ensure the entire sequence (curl | bash, apt-get update, apt-get install,
npm install -g yarn, and the rm -rf cleanup) remains in one RUN instruction.


# Enable Apache modules and set DocumentRoot to /public
RUN a2enmod rewrite headers \
&& sed -ri 's!/var/www/html!/var/www/html/public!g' /etc/apache2/sites-available/000-default.conf \
Expand All @@ -25,7 +31,7 @@ RUN a2enmod rewrite headers \
&& a2enconf phplist

# Copy composer definition first and install dependencies
COPY composer.json composer.lock ./
COPY composer.json composer.lock package.json yarn.lock ./

# Install Composer
ENV COMPOSER_ALLOW_SUPERUSER=1 \
Expand Down Expand Up @@ -53,6 +59,9 @@ RUN chown -R www-data:www-data var public \
&& find var -type d -exec chmod 775 {} \; \
&& find var -type f -exec chmod 664 {} \;

# Build frontend assets once, during image build
RUN composer run-script build-web-frontend-assets

# Expose port and run Apache
EXPOSE 80
CMD ["apache2-foreground"]
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ You can get a list of all installed phpList modules with this command:
composer run-script list-modules
```

To compile and publish the `phplist/web-frontend` assets into
`public/build` (used by the web frontend Twig templates),
run:

```bash
composer run-script build-web-frontend-assets
```
Comment on lines +154 to +160
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Document the local Node/Yarn prerequisite for this command.

composer run-script build-web-frontend-assets shells out to yarn, so on non-Docker setups this fails unless Node.js and Yarn are installed first. A short prerequisite note here would prevent a confusing first-run error.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 154 - 160, The README is missing a prerequisite note
that `composer run-script build-web-frontend-assets` invokes the `yarn` command;
update the README section around the phplist/web-frontend → public/build
instructions to add a short prerequisite sentence stating that Node.js and Yarn
must be installed locally (or point to Docker usage) before running `composer
run-script build-web-frontend-assets`, mentioning `yarn` explicitly so users
know why those tools are required.



## Creating a .tar.gz package of this distribution

Expand Down
14 changes: 12 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@
"phplist/rest-api": "dev-main",
"phplist/web-frontend": "dev-main",
"doctrine/orm": "^3.3",
"tatevikgr/rest-api-client": "dev-ISSUE-357",
"tatevikgr/rss-feed": "dev-main as 0.1.0"
"tatevikgr/rest-api-client": "dev-main",
"tatevikgr/rss-feed": "dev-main as 0.1.0",
"nelmio/cors-bundle": "^2.6"
},
"require-dev": {
"phpunit/phpunit": "^9.6.33",
Expand Down Expand Up @@ -90,6 +91,10 @@
"php bin/console cache:clear",
"php bin/console cache:warmup"
],
"build-web-frontend-assets": [
"yarn install",
"yarn build:web-frontend"
],
"post-install-cmd": [
"@create-directories",
"@update-configuration"
Expand All @@ -104,6 +109,11 @@
]
},
"extra": {
"phplist/core": {
"bundles": [
"Nelmio\\CorsBundle\\NelmioCorsBundle"
]
},
Comment thread
coderabbitai[bot] marked this conversation as resolved.
"symfony-app-dir": "bin",
"symfony-bin-dir": "bin",
"symfony-var-dir": "var",
Expand Down
Loading
Loading