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
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v24
58 changes: 58 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
FROM unit:1.34.1-php8.4

RUN apt update && apt install -y \
curl unzip git gnupg ca-certificates \
libicu-dev libzip-dev libpng-dev \
libjpeg-dev libfreetype6-dev libssl-dev libpq-dev

# Node.js 24
RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
&& apt install -y nodejs

# PHP extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg

RUN docker-php-ext-install -j$(nproc) \
pcntl opcache pdo pdo_mysql intl zip gd exif ftp bcmath

RUN docker-php-ext-install -j$(nproc) pdo_pgsql pgsql

RUN pecl install redis && docker-php-ext-enable redis

# PHP config
RUN echo "opcache.enable=1" > /usr/local/etc/php/conf.d/custom.ini \
&& echo "opcache.jit=tracing" >> /usr/local/etc/php/conf.d/custom.ini \
&& echo "opcache.jit_buffer_size=256M" >> /usr/local/etc/php/conf.d/custom.ini \
&& echo "memory_limit=512M" >> /usr/local/etc/php/conf.d/custom.ini \
&& echo "upload_max_filesize=64M" >> /usr/local/etc/php/conf.d/custom.ini \
&& echo "post_max_size=64M" >> /usr/local/etc/php/conf.d/custom.ini

COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer

WORKDIR /var/www/html

# Cache layers
COPY package*.json ./
COPY composer.json composer.lock ./

RUN npm install
RUN composer install --no-scripts --prefer-dist --no-interaction

# App
COPY . .

RUN composer dump-autoload --optimize
RUN php artisan package:discover --ansi

# Front build
RUN npm run build

RUN mkdir -p storage bootstrap/cache \
&& chown -R unit:unit storage bootstrap/cache \
&& chmod -R 775 storage bootstrap/cache

COPY unit.json /docker-entrypoint.d/unit.json

EXPOSE 8000

CMD ["unitd", "--no-daemon"]
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions unit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"listeners": {
"*:8000": {
"pass": "routes"
}
},

"routes": [
{
"match": {
"uri": "!/index.php"
},
"action": {
"share": "/var/www/html/public$uri",
"fallback": {
"pass": "applications/laravel"
}
}
}
],

"applications": {
"laravel": {
"type": "php",
"root": "/var/www/html/public/",
"script": "index.php"
}
}
}
Loading