-
Notifications
You must be signed in to change notification settings - Fork 11
feat: complete the Docker setup — wire the compose stack, add a PHP 8.4 CLI image (IP-149) #601
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| FROM httpd:2.4-alpine | ||
|
|
||
| # Enable required Apache modules for PHP-FPM proxying | ||
| RUN sed -i \ | ||
| -e 's/^#\(LoadModule proxy_module modules\/mod_proxy.so\)/\1/' \ | ||
| -e 's/^#\(LoadModule proxy_fcgi_module modules\/mod_proxy_fcgi.so\)/\1/' \ | ||
| -e 's/^#\(LoadModule rewrite_module modules\/mod_rewrite.so\)/\1/' \ | ||
| /usr/local/apache2/conf/httpd.conf | ||
|
|
||
| COPY config/invoiceplane-vhost.conf /usr/local/apache2/conf/extra/invoiceplane-vhost.conf | ||
|
|
||
| RUN echo "Include conf/extra/invoiceplane-vhost.conf" >> /usr/local/apache2/conf/httpd.conf | ||
|
|
||
| EXPOSE 80 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| <VirtualHost *:80> | ||
| ServerName localhost | ||
| DocumentRoot "/usr/local/apache2/htdocs/public" | ||
|
|
||
| <Directory "/usr/local/apache2/htdocs/public"> | ||
| Options Indexes FollowSymLinks | ||
| AllowOverride All | ||
| Require all granted | ||
| </Directory> | ||
|
|
||
| # ProxyPass for PHP-FPM with correct document root | ||
| <FilesMatch \.php$> | ||
| SetHandler "proxy:fcgi://app:9000/var/www/html/public" | ||
| </FilesMatch> | ||
|
|
||
| # Fallback for PATH_INFO | ||
| ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://app:9000/var/www/html/public/$1 | ||
|
|
||
| ErrorLog /usr/local/apache2/logs/invoiceplane_error.log | ||
| CustomLog /usr/local/apache2/logs/invoiceplane_access.log combined | ||
| </VirtualHost> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/bin/sh | ||
|
|
||
| # Copy original vite.config.js to Docker-specific version | ||
| mkdir -p /app/.docker | ||
| cp /app/vite.config.js /app/.docker/vite.config.docker.js | ||
|
|
||
| # Update resource paths to absolute paths | ||
| sed -i "s|'resources/css/app.css'|'/app/resources/css/app.css'|g" /app/.docker/vite.config.docker.js | ||
| sed -i "s|'resources/js/app.js'|'/app/resources/js/app.js'|g" /app/.docker/vite.config.docker.js | ||
|
|
||
| # Add Docker-specific server configuration if not already present | ||
| if ! grep -q "server:" /app/.docker/vite.config.docker.js; then | ||
| # Insert server config before the closing }); of defineConfig | ||
| sed -i '/^});$/i\ server: {\n host: '\''0.0.0.0'\'',\n port: 5173,\n hmr: {\n host: '\''localhost'\'',\n },\n },' /app/.docker/vite.config.docker.js | ||
| fi | ||
|
|
||
| # Install dependencies and start Vite with Docker config | ||
| npm install && npm run dev -- --config .docker/vite.config.docker.js | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| FROM php:8.4-cli-alpine | ||
|
|
||
| # Match the host user so files created in mounted volumes (vendor/, | ||
| # storage/, compiled views) keep sane ownership. Override at build time: | ||
| # docker compose build --build-arg UID=$(id -u) --build-arg GID=$(id -g) cli | ||
| ARG UID=1000 | ||
| ARG GID=1000 | ||
|
|
||
| RUN addgroup -g ${GID} dockeruser \ | ||
| && adduser -D -s /bin/bash -u ${UID} -G dockeruser dockeruser | ||
|
|
||
| # Install build dependencies (temporary) | ||
| RUN apk add --no-cache --virtual .build-deps \ | ||
| autoconf \ | ||
| g++ \ | ||
| make \ | ||
| pkgconf \ | ||
| zstd-dev \ | ||
| # Install runtime dependencies (permanent) | ||
| && apk add --no-cache \ | ||
| bash \ | ||
| git \ | ||
| curl \ | ||
| zip \ | ||
| unzip \ | ||
| icu-dev \ | ||
| libxml2-dev \ | ||
| oniguruma-dev \ | ||
| libzip-dev \ | ||
| libpng-dev \ | ||
| libjpeg-turbo-dev \ | ||
| freetype-dev \ | ||
| zstd \ | ||
| # Configure and install PHP extensions (pdo_sqlite ships with the base | ||
| # image — the test suite runs on an in-memory sqlite database) | ||
| && docker-php-ext-configure gd --with-freetype --with-jpeg \ | ||
| && docker-php-ext-install -j$(nproc) \ | ||
| pdo \ | ||
| pdo_mysql \ | ||
| mbstring \ | ||
| exif \ | ||
| pcntl \ | ||
| bcmath \ | ||
| gd \ | ||
| zip \ | ||
| intl \ | ||
| xml \ | ||
| soap \ | ||
| opcache \ | ||
| # Install PECL extensions | ||
| && pecl install redis \ | ||
| && docker-php-ext-enable redis \ | ||
| # Remove only build dependencies | ||
| && apk del .build-deps \ | ||
| && rm -rf /var/cache/apk/* | ||
|
|
||
| # PHPUnit needs more than the 128M default on the full suite | ||
| RUN echo 'memory_limit=1G' > /usr/local/etc/php/conf.d/memory-limit.ini | ||
|
|
||
| # Install Composer | ||
| RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | ||
|
|
||
| USER dockeruser | ||
|
|
||
| WORKDIR /var/www/html | ||
|
|
||
| CMD ["php", "-a"] |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,58 @@ | ||||||||||||||
| FROM php:8.4-fpm-alpine | ||||||||||||||
|
|
||||||||||||||
| RUN adduser -D -s /bin/bash dockeruser | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win FPM container lacks configurable UID/GID. The CLI Dockerfile accepts Proposed fix+ARG UID=1000
+ARG GID=1000
+
+RUN addgroup -g ${GID} dockeruser \
+ && adduser -D -s /bin/bash -u ${UID} -G dockeruser dockeruser
-RUN adduser -D -s /bin/bash dockeruserAnd in app:
container_name: 'ivplflmnt_app'
build:
context: ./docker-resources/php-fpm
+ args:
+ UID: ${UID:-1000}
+ GID: ${GID:-1000}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| # Install build dependencies (temporary) | ||||||||||||||
| RUN apk add --no-cache --virtual .build-deps \ | ||||||||||||||
| autoconf \ | ||||||||||||||
| g++ \ | ||||||||||||||
| make \ | ||||||||||||||
| pkgconf \ | ||||||||||||||
| zstd-dev \ | ||||||||||||||
| # Install runtime dependencies (permanent) | ||||||||||||||
| && apk add --no-cache \ | ||||||||||||||
| bash \ | ||||||||||||||
| git \ | ||||||||||||||
| curl \ | ||||||||||||||
| zip \ | ||||||||||||||
| unzip \ | ||||||||||||||
| icu-dev \ | ||||||||||||||
| libxml2-dev \ | ||||||||||||||
| oniguruma-dev \ | ||||||||||||||
| libzip-dev \ | ||||||||||||||
| libpng-dev \ | ||||||||||||||
| libjpeg-turbo-dev \ | ||||||||||||||
| freetype-dev \ | ||||||||||||||
| zstd \ | ||||||||||||||
| # Configure and install PHP extensions | ||||||||||||||
| && docker-php-ext-configure gd --with-freetype --with-jpeg \ | ||||||||||||||
| && docker-php-ext-install -j$(nproc) \ | ||||||||||||||
| pdo \ | ||||||||||||||
| pdo_mysql \ | ||||||||||||||
| mbstring \ | ||||||||||||||
| exif \ | ||||||||||||||
| pcntl \ | ||||||||||||||
| bcmath \ | ||||||||||||||
| gd \ | ||||||||||||||
| zip \ | ||||||||||||||
| intl \ | ||||||||||||||
| xml \ | ||||||||||||||
| soap \ | ||||||||||||||
| opcache \ | ||||||||||||||
| # Install PECL extensions | ||||||||||||||
| && pecl install redis \ | ||||||||||||||
| && docker-php-ext-enable redis \ | ||||||||||||||
| # Remove only build dependencies | ||||||||||||||
| && apk del .build-deps \ | ||||||||||||||
| && rm -rf /var/cache/apk/* | ||||||||||||||
|
|
||||||||||||||
| # Install Composer | ||||||||||||||
| RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | ||||||||||||||
|
|
||||||||||||||
| USER dockeruser | ||||||||||||||
|
|
||||||||||||||
| WORKDIR /var/www/html | ||||||||||||||
|
|
||||||||||||||
| EXPOSE 9000 | ||||||||||||||
|
|
||||||||||||||
| CMD ["php-fpm"] | ||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Add
set -eto fail fast on copy/sed errors.Without
set -e, ifcporsedfails (e.g.,vite.config.jsmissing), the script continues tonpm install && npm run dev, which fails with a confusing "config file not found" error instead of surfacing the original failure.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents