FIXING TICKET SAVE

This commit is contained in:
Mark Gregory
2026-06-12 11:28:33 +01:00
parent fbc2ebce2d
commit 55428efaef
29 changed files with 8 additions and 1561 deletions
@@ -25,22 +25,16 @@ final class HelpdeskServiceProvider extends ServiceProvider
{
/**
* Module name.
*
* @var string
*/
protected string $moduleName = 'Helpdesk';
/**
* Lowercase module name.
*
* @var string
*/
protected string $moduleNameLower = 'helpdesk';
/**
* Register module services.
*
* @return void
*/
public function register(): void
{
@@ -54,8 +48,6 @@ final class HelpdeskServiceProvider extends ServiceProvider
/**
* Bootstrap module services.
*
* @return void
*/
public function boot(): void
{
@@ -79,8 +71,6 @@ final class HelpdeskServiceProvider extends ServiceProvider
/**
* Register Livewire components used by the module.
*
* @return void
*/
protected function registerLivewireComponents(): void
{
@@ -94,8 +84,6 @@ final class HelpdeskServiceProvider extends ServiceProvider
/**
* Register policies and gates.
*
* @return void
*/
protected function registerPolicies(): void
{
@@ -107,8 +95,6 @@ final class HelpdeskServiceProvider extends ServiceProvider
/**
* Register helpers.
*
* @return void
*/
protected function registerHelpers(): void
{
@@ -119,8 +105,6 @@ final class HelpdeskServiceProvider extends ServiceProvider
/**
* Dynamically register console commands.
*
* @return void
*/
protected function registerCommands(): void
{
@@ -135,7 +119,7 @@ final class HelpdeskServiceProvider extends ServiceProvider
}
$commands = collect(File::allFiles($commandPath))
->map(fn ($file): string => 'Modules\\' . $this->moduleName . '\\Console\\' . $file->getFilenameWithoutExtension())
->map(fn ($file): string => 'Modules\\'.$this->moduleName.'\\Console\\'.$file->getFilenameWithoutExtension())
->filter(fn (string $class): bool => class_exists($class))
->values()
->all();
@@ -145,44 +129,38 @@ final class HelpdeskServiceProvider extends ServiceProvider
/**
* Register config publishing.
*
* @return void
*/
protected function registerConfig(): void
{
$this->publishes([
module_path(ModuleInfo::name(), 'Config/config.php') => config_path(ModuleInfo::nameLower() . '.php'),
module_path(ModuleInfo::name(), 'Config/config.php') => config_path(ModuleInfo::nameLower().'.php'),
], 'config');
}
/**
* Register module views.
*
* @return void
*/
protected function registerViews(): void
{
$viewPath = resource_path('views/modules/' . ModuleInfo::nameLower());
$viewPath = resource_path('views/modules/'.ModuleInfo::nameLower());
$sourcePath = module_path(ModuleInfo::name(), 'Resources/views');
$this->publishes([
$sourcePath => $viewPath,
], ['views', ModuleInfo::nameLower() . '-module-views']);
], ['views', ModuleInfo::nameLower().'-module-views']);
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), ModuleInfo::nameLower());
Blade::componentNamespace('Modules\Helpdesk\View\Components', 'helpdesk');
Blade::anonymousComponentPath($sourcePath . '/components', 'helpdesk');
Blade::anonymousComponentPath($sourcePath.'/components', 'helpdesk');
}
/**
* Register translations.
*
* @return void
*/
protected function registerTranslations(): void
{
$langPath = resource_path('lang/modules/' . ModuleInfo::nameLower());
$langPath = resource_path('lang/modules/'.ModuleInfo::nameLower());
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, ModuleInfo::nameLower());
@@ -203,8 +181,8 @@ final class HelpdeskServiceProvider extends ServiceProvider
$paths = [];
foreach (Config::get('view.paths') as $path) {
if (is_dir($path . '/modules/' . ModuleInfo::nameLower())) {
$paths[] = $path . '/modules/' . ModuleInfo::nameLower();
if (is_dir($path.'/modules/'.ModuleInfo::nameLower())) {
$paths[] = $path.'/modules/'.ModuleInfo::nameLower();
}
}
-93
View File
@@ -1,93 +0,0 @@
FROM ubuntu:24.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=24
ARG MYSQL_CLIENT="mysql-client"
ARG POSTGRES_VERSION=18
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
ENV LANG=C.UTF-8
ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80"
ENV SUPERVISOR_PHP_USER="sail"
ENV PLAYWRIGHT_BROWSERS_PATH=0
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN echo "Acquire::http::Pipeline-Depth 0;" > /etc/apt/apt.conf.d/99custom && \
echo "Acquire::http::No-Cache true;" >> /etc/apt/apt.conf.d/99custom && \
echo "Acquire::BrokenProxy true;" >> /etc/apt/apt.conf.d/99custom
RUN apt-get update && apt-get upgrade -y \
&& mkdir -p /etc/apt/keyrings \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python3 dnsutils librsvg2-bin fswatch ffmpeg nano \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xb8dc7e53946656efbce4c1dd71daeaab4ad4cab6' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu noble main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y \
libgd3 \
php8.0-cli \
php8.0-dev \
php8.0-pgsql \
php8.0-sqlite3 \
php8.0-gd \
php8.0-curl \
php8.0-mongodb \
php8.0-imap \
php8.0-mysql \
php8.0-mbstring \
php8.0-xml \
php8.0-zip \
php8.0-bcmath \
php8.0-soap \
php8.0-intl \
php8.0-readline \
php8.0-ldap \
php8.0-msgpack \
php8.0-igbinary \
php8.0-redis \
php8.0-swoole \
php8.0-memcached \
php8.0-pcov \
php8.0-imagick \
php8.0-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install -y nodejs \
&& npm install -g npm \
&& npm install -g pnpm \
&& npm install -g bun \
&& npx playwright install-deps \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /etc/apt/keyrings/yarnkey.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt noble-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y yarn \
&& apt-get install -y $MYSQL_CLIENT \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.0
RUN userdel -r ubuntu
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
RUN git config --global --add safe.directory /var/www/html
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.0/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 80/tcp
ENTRYPOINT ["start-container"]
-5
View File
@@ -1,5 +0,0 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
pcov.directory = .
-26
View File
@@ -1,26 +0,0 @@
#!/usr/bin/env bash
if [ "$SUPERVISOR_PHP_USER" != "root" ] && [ "$SUPERVISOR_PHP_USER" != "sail" ]; then
echo "You should set SUPERVISOR_PHP_USER to either 'sail' or 'root'."
exit 1
fi
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
if [ "$SUPERVISOR_PHP_USER" = "root" ]; then
exec "$@"
else
exec gosu $WWWUSER "$@"
fi
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi
-14
View File
@@ -1,14 +0,0 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=%(ENV_SUPERVISOR_PHP_COMMAND)s
user=%(ENV_SUPERVISOR_PHP_USER)s
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
-93
View File
@@ -1,93 +0,0 @@
FROM ubuntu:24.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=24
ARG MYSQL_CLIENT="mysql-client"
ARG POSTGRES_VERSION=18
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
ENV LANG=C.UTF-8
ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80"
ENV SUPERVISOR_PHP_USER="sail"
ENV PLAYWRIGHT_BROWSERS_PATH=0
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN echo "Acquire::http::Pipeline-Depth 0;" > /etc/apt/apt.conf.d/99custom && \
echo "Acquire::http::No-Cache true;" >> /etc/apt/apt.conf.d/99custom && \
echo "Acquire::BrokenProxy true;" >> /etc/apt/apt.conf.d/99custom
RUN apt-get update && apt-get upgrade -y \
&& mkdir -p /etc/apt/keyrings \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python3 dnsutils librsvg2-bin fswatch ffmpeg nano \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xb8dc7e53946656efbce4c1dd71daeaab4ad4cab6' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu noble main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y \
libgd3 \
php8.1-cli \
php8.1-dev \
php8.1-pgsql \
php8.1-sqlite3 \
php8.1-gd \
php8.1-curl \
php8.1-mongodb \
php8.1-imap \
php8.1-mysql \
php8.1-mbstring \
php8.1-xml \
php8.1-zip \
php8.1-bcmath \
php8.1-soap \
php8.1-intl \
php8.1-readline \
php8.1-ldap \
php8.1-msgpack \
php8.1-igbinary \
php8.1-redis \
php8.1-swoole \
php8.1-memcached \
php8.1-pcov \
php8.1-imagick \
php8.1-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install -y nodejs \
&& npm install -g npm \
&& npm install -g pnpm \
&& npm install -g bun \
&& npx playwright install-deps \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /etc/apt/keyrings/yarnkey.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt noble-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y yarn \
&& apt-get install -y $MYSQL_CLIENT \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.1
RUN userdel -r ubuntu
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
RUN git config --global --add safe.directory /var/www/html
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.1/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 80/tcp
ENTRYPOINT ["start-container"]
-5
View File
@@ -1,5 +0,0 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
pcov.directory = .
-26
View File
@@ -1,26 +0,0 @@
#!/usr/bin/env bash
if [ "$SUPERVISOR_PHP_USER" != "root" ] && [ "$SUPERVISOR_PHP_USER" != "sail" ]; then
echo "You should set SUPERVISOR_PHP_USER to either 'sail' or 'root'."
exit 1
fi
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
if [ "$SUPERVISOR_PHP_USER" = "root" ]; then
exec "$@"
else
exec gosu $WWWUSER "$@"
fi
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi
-14
View File
@@ -1,14 +0,0 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=%(ENV_SUPERVISOR_PHP_COMMAND)s
user=%(ENV_SUPERVISOR_PHP_USER)s
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
-90
View File
@@ -1,90 +0,0 @@
FROM ubuntu:24.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=24
ARG MYSQL_CLIENT="mysql-client"
ARG POSTGRES_VERSION=18
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
ENV LANG=C.UTF-8
ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80"
ENV SUPERVISOR_PHP_USER="sail"
ENV PLAYWRIGHT_BROWSERS_PATH=0
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN echo "Acquire::http::Pipeline-Depth 0;" > /etc/apt/apt.conf.d/99custom && \
echo "Acquire::http::No-Cache true;" >> /etc/apt/apt.conf.d/99custom && \
echo "Acquire::BrokenProxy true;" >> /etc/apt/apt.conf.d/99custom
RUN apt-get update && apt-get upgrade -y \
&& mkdir -p /etc/apt/keyrings \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python3 dnsutils librsvg2-bin fswatch ffmpeg nano \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xb8dc7e53946656efbce4c1dd71daeaab4ad4cab6' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu noble main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y \
libgd3 \
php8.2-cli \
php8.2-dev \
php8.2-pgsql \
php8.2-sqlite3 \
php8.2-gd \
php8.2-curl \
php8.2-mongodb \
php8.2-imap \
php8.2-mysql \
php8.2-mbstring \
php8.2-xml \
php8.2-zip \
php8.2-bcmath \
php8.2-soap \
php8.2-intl \
php8.2-readline \
php8.2-ldap \
php8.2-msgpack \
php8.2-igbinary \
php8.2-redis \
php8.2-swoole \
php8.2-memcached \
php8.2-pcov \
php8.2-imagick \
php8.2-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install -y nodejs \
&& npm install -g npm pnpm bun corepack \
&& corepack enable \
&& corepack prepare yarn@stable --activate \
&& npx -y playwright install-deps \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt noble-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y $MYSQL_CLIENT \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.2
RUN userdel -r ubuntu
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
RUN git config --global --add safe.directory /var/www/html
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.2/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 80/tcp
ENTRYPOINT ["start-container"]
-5
View File
@@ -1,5 +0,0 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
pcov.directory = .
-26
View File
@@ -1,26 +0,0 @@
#!/usr/bin/env bash
if [ "$SUPERVISOR_PHP_USER" != "root" ] && [ "$SUPERVISOR_PHP_USER" != "sail" ]; then
echo "You should set SUPERVISOR_PHP_USER to either 'sail' or 'root'."
exit 1
fi
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
if [ "$SUPERVISOR_PHP_USER" = "root" ]; then
exec "$@"
else
exec gosu $WWWUSER "$@"
fi
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi
-14
View File
@@ -1,14 +0,0 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=%(ENV_SUPERVISOR_PHP_COMMAND)s
user=%(ENV_SUPERVISOR_PHP_USER)s
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
-90
View File
@@ -1,90 +0,0 @@
FROM ubuntu:24.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=24
ARG MYSQL_CLIENT="mysql-client"
ARG POSTGRES_VERSION=18
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
ENV LANG=C.UTF-8
ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80"
ENV SUPERVISOR_PHP_USER="sail"
ENV PLAYWRIGHT_BROWSERS_PATH=0
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN echo "Acquire::http::Pipeline-Depth 0;" > /etc/apt/apt.conf.d/99custom && \
echo "Acquire::http::No-Cache true;" >> /etc/apt/apt.conf.d/99custom && \
echo "Acquire::BrokenProxy true;" >> /etc/apt/apt.conf.d/99custom
RUN apt-get update && apt-get upgrade -y \
&& mkdir -p /etc/apt/keyrings \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python3 dnsutils librsvg2-bin fswatch ffmpeg nano \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xb8dc7e53946656efbce4c1dd71daeaab4ad4cab6' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu noble main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y \
libgd3 \
php8.3-cli \
php8.3-dev \
php8.3-pgsql \
php8.3-sqlite3 \
php8.3-gd \
php8.3-curl \
php8.3-mongodb \
php8.3-imap \
php8.3-mysql \
php8.3-mbstring \
php8.3-xml \
php8.3-zip \
php8.3-bcmath \
php8.3-soap \
php8.3-intl \
php8.3-readline \
php8.3-ldap \
php8.3-msgpack \
php8.3-igbinary \
php8.3-redis \
php8.3-swoole \
php8.3-memcached \
php8.3-pcov \
php8.3-imagick \
php8.3-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install -y nodejs \
&& npm install -g npm pnpm bun corepack \
&& corepack enable \
&& corepack prepare yarn@stable --activate \
&& npx -y playwright install-deps \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt noble-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y $MYSQL_CLIENT \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.3
RUN userdel -r ubuntu
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
RUN git config --global --add safe.directory /var/www/html
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.3/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 80/tcp
ENTRYPOINT ["start-container"]
-5
View File
@@ -1,5 +0,0 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
pcov.directory = .
-26
View File
@@ -1,26 +0,0 @@
#!/usr/bin/env bash
if [ "$SUPERVISOR_PHP_USER" != "root" ] && [ "$SUPERVISOR_PHP_USER" != "sail" ]; then
echo "You should set SUPERVISOR_PHP_USER to either 'sail' or 'root'."
exit 1
fi
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
if [ "$SUPERVISOR_PHP_USER" = "root" ]; then
exec "$@"
else
exec gosu $WWWUSER "$@"
fi
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi
-14
View File
@@ -1,14 +0,0 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=%(ENV_SUPERVISOR_PHP_COMMAND)s
user=%(ENV_SUPERVISOR_PHP_USER)s
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
-90
View File
@@ -1,90 +0,0 @@
FROM ubuntu:24.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=24
ARG MYSQL_CLIENT="mysql-client"
ARG POSTGRES_VERSION=18
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
ENV LANG=C.UTF-8
ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80"
ENV SUPERVISOR_PHP_USER="sail"
ENV PLAYWRIGHT_BROWSERS_PATH=0
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN echo "Acquire::http::Pipeline-Depth 0;" > /etc/apt/apt.conf.d/99custom && \
echo "Acquire::http::No-Cache true;" >> /etc/apt/apt.conf.d/99custom && \
echo "Acquire::BrokenProxy true;" >> /etc/apt/apt.conf.d/99custom
RUN apt-get update && apt-get upgrade -y \
&& mkdir -p /etc/apt/keyrings \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python3 dnsutils librsvg2-bin fswatch ffmpeg nano \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xb8dc7e53946656efbce4c1dd71daeaab4ad4cab6' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu noble main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y \
libgd3 \
php8.4-cli \
php8.4-dev \
php8.4-pgsql \
php8.4-sqlite3 \
php8.4-gd \
php8.4-curl \
php8.4-mongodb \
php8.4-imap \
php8.4-mysql \
php8.4-mbstring \
php8.4-xml \
php8.4-zip \
php8.4-bcmath \
php8.4-soap \
php8.4-intl \
php8.4-readline \
php8.4-ldap \
php8.4-msgpack \
php8.4-igbinary \
php8.4-redis \
php8.4-swoole \
php8.4-memcached \
php8.4-pcov \
php8.4-imagick \
php8.4-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install -y nodejs \
&& npm install -g npm pnpm bun corepack \
&& corepack enable \
&& corepack prepare yarn@stable --activate \
&& npx -y playwright install-deps \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt noble-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y $MYSQL_CLIENT \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.4
RUN userdel -r ubuntu
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
RUN git config --global --add safe.directory /var/www/html
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.4/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 80/tcp
ENTRYPOINT ["start-container"]
-5
View File
@@ -1,5 +0,0 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
pcov.directory = .
-26
View File
@@ -1,26 +0,0 @@
#!/usr/bin/env bash
if [ "$SUPERVISOR_PHP_USER" != "root" ] && [ "$SUPERVISOR_PHP_USER" != "sail" ]; then
echo "You should set SUPERVISOR_PHP_USER to either 'sail' or 'root'."
exit 1
fi
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
if [ "$SUPERVISOR_PHP_USER" = "root" ]; then
exec "$@"
else
exec gosu $WWWUSER "$@"
fi
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi
-14
View File
@@ -1,14 +0,0 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=%(ENV_SUPERVISOR_PHP_COMMAND)s
user=%(ENV_SUPERVISOR_PHP_USER)s
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
-90
View File
@@ -1,90 +0,0 @@
FROM ubuntu:24.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=24
ARG MYSQL_CLIENT="mysql-client"
ARG POSTGRES_VERSION=18
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
ENV LANG=C.UTF-8
ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80"
ENV SUPERVISOR_PHP_USER="sail"
ENV PLAYWRIGHT_BROWSERS_PATH=0
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN echo "Acquire::http::Pipeline-Depth 0;" > /etc/apt/apt.conf.d/99custom && \
echo "Acquire::http::No-Cache true;" >> /etc/apt/apt.conf.d/99custom && \
echo "Acquire::BrokenProxy true;" >> /etc/apt/apt.conf.d/99custom
RUN apt-get update && apt-get upgrade -y \
&& mkdir -p /etc/apt/keyrings \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python3 dnsutils librsvg2-bin fswatch ffmpeg nano \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xb8dc7e53946656efbce4c1dd71daeaab4ad4cab6' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu noble main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y \
libgd3 \
php8.5-cli \
php8.5-dev \
php8.5-pgsql \
php8.5-sqlite3 \
php8.5-gd \
php8.5-curl \
php8.5-mongodb \
php8.5-imap \
php8.5-mysql \
php8.5-mbstring \
php8.5-xml \
php8.5-zip \
php8.5-bcmath \
php8.5-soap \
php8.5-intl \
php8.5-readline \
php8.5-ldap \
php8.5-msgpack \
php8.5-igbinary \
php8.5-redis \
php8.5-swoole \
php8.5-memcached \
php8.5-pcov \
php8.5-imagick \
php8.5-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install -y nodejs \
&& npm install -g npm pnpm bun corepack \
&& corepack enable \
&& corepack prepare yarn@stable --activate \
&& npx -y playwright install-deps \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt noble-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y $MYSQL_CLIENT \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.5
RUN userdel -r ubuntu
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
RUN git config --global --add safe.directory /var/www/html
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.5/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 80/tcp
ENTRYPOINT ["start-container"]
-5
View File
@@ -1,5 +0,0 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
pcov.directory = .
-26
View File
@@ -1,26 +0,0 @@
#!/usr/bin/env bash
if [ "$SUPERVISOR_PHP_USER" != "root" ] && [ "$SUPERVISOR_PHP_USER" != "sail" ]; then
echo "You should set SUPERVISOR_PHP_USER to either 'sail' or 'root'."
exit 1
fi
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
if [ "$SUPERVISOR_PHP_USER" = "root" ]; then
exec "$@"
else
exec gosu $WWWUSER "$@"
fi
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi
-14
View File
@@ -1,14 +0,0 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=%(ENV_SUPERVISOR_PHP_COMMAND)s
user=%(ENV_SUPERVISOR_PHP_USER)s
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
-11
View File
@@ -1,11 +0,0 @@
#!/usr/bin/env bash
/usr/bin/mariadb --user=root --password="$MYSQL_ROOT_PASSWORD" <<-EOSQL
CREATE DATABASE IF NOT EXISTS testing;
EOSQL
if [ -n "$MYSQL_USER" ]; then
/usr/bin/mariadb --user=root --password="$MYSQL_ROOT_PASSWORD" <<-EOSQL
GRANT ALL PRIVILEGES ON \`testing%\`.* TO '$MYSQL_USER'@'%';
EOSQL
fi
-11
View File
@@ -1,11 +0,0 @@
#!/usr/bin/env bash
mysql --user=root --password="$MYSQL_ROOT_PASSWORD" <<-EOSQL
CREATE DATABASE IF NOT EXISTS testing;
EOSQL
if [ -n "$MYSQL_USER" ]; then
mysql --user=root --password="$MYSQL_ROOT_PASSWORD" <<-EOSQL
GRANT ALL PRIVILEGES ON \`testing%\`.* TO '$MYSQL_USER'@'%';
EOSQL
fi
-2
View File
@@ -1,2 +0,0 @@
SELECT 'CREATE DATABASE testing'
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'testing')\gexec
-691
View File
@@ -1,691 +0,0 @@
#!/usr/bin/env bash
UNAMEOUT="$(uname -s)"
# Verify operating system is supported...
case "${UNAMEOUT}" in
Linux*) MACHINE=linux;;
Darwin*) MACHINE=mac;;
*) MACHINE="UNKNOWN"
esac
if [ "$MACHINE" == "UNKNOWN" ]; then
echo "Unsupported operating system [$(uname -s)]. Laravel Sail supports macOS, Linux, and Windows (WSL2)." >&2
exit 1
fi
# Determine if stdout is a terminal...
if test -t 1; then
# Determine if colors are supported...
ncolors=$(tput colors)
if test -n "$ncolors" && test "$ncolors" -ge 8; then
BOLD="$(tput bold)"
YELLOW="$(tput setaf 3)"
GREEN="$(tput setaf 2)"
NC="$(tput sgr0)"
fi
fi
# Function that prints the available commands...
function display_help {
echo "Laravel Sail"
echo
echo "${YELLOW}Usage:${NC}" >&2
echo " sail COMMAND [options] [arguments]"
echo
echo "Unknown commands are passed to the docker-compose binary."
echo
echo "${YELLOW}docker-compose Commands:${NC}"
echo " ${GREEN}sail up${NC} Start the application"
echo " ${GREEN}sail up -d${NC} Start the application in the background"
echo " ${GREEN}sail stop${NC} Stop the application"
echo " ${GREEN}sail restart${NC} Restart the application"
echo " ${GREEN}sail ps${NC} Display the status of all containers"
echo
echo "${YELLOW}Artisan Commands:${NC}"
echo " ${GREEN}sail artisan ...${NC} Run an Artisan command"
echo " ${GREEN}sail artisan queue:work${NC}"
echo
echo "${YELLOW}PHP Commands:${NC}"
echo " ${GREEN}sail php ...${NC} Run a snippet of PHP code"
echo " ${GREEN}sail php -v${NC}"
echo
echo "${YELLOW}Composer Commands:${NC}"
echo " ${GREEN}sail composer ...${NC} Run a Composer command"
echo " ${GREEN}sail composer require laravel/sanctum${NC}"
echo
echo "${YELLOW}Node Commands:${NC}"
echo " ${GREEN}sail node ...${NC} Run a Node command"
echo " ${GREEN}sail node --version${NC}"
echo
echo "${YELLOW}NPM Commands:${NC}"
echo " ${GREEN}sail npm ...${NC} Run a npm command"
echo " ${GREEN}sail npx${NC} Run a npx command"
echo " ${GREEN}sail npm run prod${NC}"
echo
echo "${YELLOW}PNPM Commands:${NC}"
echo " ${GREEN}sail pnpm ...${NC} Run a pnpm command"
echo " ${GREEN}sail pnpx${NC} Run a pnpx command"
echo " ${GREEN}sail pnpm run prod${NC}"
echo
echo "${YELLOW}Yarn Commands:${NC}"
echo " ${GREEN}sail yarn ...${NC} Run a Yarn command"
echo " ${GREEN}sail yarn run prod${NC}"
echo
echo "${YELLOW}Bun Commands:${NC}"
echo " ${GREEN}sail bun ...${NC} Run a bun command"
echo " ${GREEN}sail bunx${NC} Run a bunx command"
echo " ${GREEN}sail bun run prod${NC}"
echo
echo "${YELLOW}Database Commands:${NC}"
echo " ${GREEN}sail mysql${NC} Start a MySQL CLI session within the 'mysql' container"
echo " ${GREEN}sail mariadb${NC} Start a MySQL CLI session within the 'mariadb' container"
echo " ${GREEN}sail psql${NC} Start a PostgreSQL CLI session within the 'pgsql' container"
echo " ${GREEN}sail mongodb${NC} Start a Mongo Shell session within the 'mongodb' container"
echo " ${GREEN}sail redis${NC} Start a Redis CLI session within the 'redis' container"
echo " ${GREEN}sail valkey${NC} Start a Valkey CLI session within the 'valkey' container"
echo
echo "${YELLOW}Debugging:${NC}"
echo " ${GREEN}sail debug ...${NC} Run an Artisan command in debug mode"
echo " ${GREEN}sail debug queue:work${NC}"
echo
echo "${YELLOW}Running Tests:${NC}"
echo " ${GREEN}sail test${NC} Run the PHPUnit tests via the Artisan test command"
echo " ${GREEN}sail phpunit ...${NC} Run PHPUnit"
echo " ${GREEN}sail pest ...${NC} Run Pest"
echo " ${GREEN}sail pint ...${NC} Run Pint"
echo " ${GREEN}sail dusk${NC} Run the Dusk tests (Requires the laravel/dusk package)"
echo " ${GREEN}sail dusk:fails${NC} Re-run previously failed Dusk tests (Requires the laravel/dusk package)"
echo
echo "${YELLOW}Container CLI:${NC}"
echo " ${GREEN}sail shell${NC} Start a shell session within the application container"
echo " ${GREEN}sail bash${NC} Alias for 'sail shell'"
echo " ${GREEN}sail root-shell${NC} Start a root shell session within the application container"
echo " ${GREEN}sail root-bash${NC} Alias for 'sail root-shell'"
echo " ${GREEN}sail tinker${NC} Start a new Laravel Tinker session"
echo
echo "${YELLOW}Sharing:${NC}"
echo " ${GREEN}sail share${NC} Share the application publicly via a temporary URL"
echo " ${GREEN}sail open${NC} Open the site in your browser"
echo
echo "${YELLOW}Binaries:${NC}"
echo " ${GREEN}sail bin ...${NC} Run Composer binary scripts from the vendor/bin directory"
echo " ${GREEN}sail run ...${NC} Run a command within the application container"
echo
echo "${YELLOW}Customization:${NC}"
echo " ${GREEN}sail artisan sail:publish${NC} Publish the Sail configuration files"
echo " ${GREEN}sail build --no-cache${NC} Rebuild all of the Sail containers"
exit 1
}
# Proxy the "help" command...
if [ $# -gt 0 ]; then
if [ "$1" == "help" ] || [ "$1" == "-h" ] || [ "$1" == "-help" ] || [ "$1" == "--help" ]; then
display_help
fi
else
display_help
fi
# Source the ".env" file so Laravel's environment variables are available...
# shellcheck source=/dev/null
if [ -n "$APP_ENV" ] && [ -f ./.env."$APP_ENV" ]; then
source ./.env."$APP_ENV";
elif [ -f ./.env ]; then
source ./.env;
fi
# Define environment variables...
export APP_PORT=${APP_PORT:-80}
export APP_SERVICE=${APP_SERVICE:-"laravel.test"}
export APP_USER=${APP_USER:-"sail"}
export DB_PORT=${DB_PORT:-3306}
export WWWUSER=${WWWUSER:-$UID}
export WWWGROUP=${WWWGROUP:-$(id -g)}
export SAIL_FILES=${SAIL_FILES:-""}
export SAIL_SHARE_DASHBOARD=${SAIL_SHARE_DASHBOARD:-4040}
export SAIL_SHARE_SERVER_HOST=${SAIL_SHARE_SERVER_HOST:-"laravel-sail.site"}
export SAIL_SHARE_SERVER_PORT=${SAIL_SHARE_SERVER_PORT:-8080}
export SAIL_SHARE_SUBDOMAIN=${SAIL_SHARE_SUBDOMAIN:-""}
export SAIL_SHARE_DOMAIN=${SAIL_SHARE_DOMAIN:-"$SAIL_SHARE_SERVER_HOST"}
export SAIL_SHARE_SERVER=${SAIL_SHARE_SERVER:-""}
export SAIL_DOCKER_BINARY=${SAIL_DOCKER_BINARY:-"docker"}
# Function that outputs Sail is not running...
function sail_is_not_running {
echo "${BOLD}Sail is not running.${NC}" >&2
echo "" >&2
echo "${BOLD}You may Sail using the following commands:${NC} './vendor/bin/sail up' or './vendor/bin/sail up -d'" >&2
exit 1
}
# AI agent environment variables to forward into containers...
AGENT_ENV_VARS=(
AI_AGENT
CLAUDECODE
CLAUDE_CODE
CLAUDE_CODE_IS_COWORK
CURSOR_TRACE_ID
CURSOR_AGENT
GEMINI_CLI
CODEX_SANDBOX
CODEX_CI
CODEX_THREAD_ID
AUGMENT_AGENT
OPENCODE_CLIENT
OPENCODE
AMP_CURRENT_THREAD_ID
REPL_ID
ANTIGRAVITY_AGENT
COPILOT_MODEL
COPILOT_ALLOW_ALL
COPILOT_GITHUB_TOKEN
COPILOT_CLI
PI_CODING_AGENT
KIRO_AGENT_PATH
)
function forward_agent_env() {
for VAR in "${AGENT_ENV_VARS[@]}"; do
if [ -n "${!VAR:-}" ]; then
ARGS+=(-e "${VAR}=${!VAR}")
fi
done
}
# Define Docker Compose command prefix...
if ${SAIL_DOCKER_BINARY} compose &> /dev/null; then
COMPOSE_CMD=(${SAIL_DOCKER_BINARY} compose)
else
COMPOSE_CMD=(${SAIL_DOCKER_BINARY}-compose)
fi
if [ -n "$SAIL_FILES" ]; then
# Convert SAIL_FILES to an array...
IFS=':' read -ra SAIL_FILES <<< "$SAIL_FILES"
for FILE in "${SAIL_FILES[@]}"; do
if [ -f "$FILE" ]; then
COMPOSE_CMD+=(-f "$FILE")
else
echo "${BOLD}Unable to find Docker Compose file: '${FILE}'${NC}" >&2
exit 1
fi
done
fi
EXEC="yes"
if [ -z "$SAIL_SKIP_CHECKS" ]; then
# Ensure that Docker is running...
if ! ${SAIL_DOCKER_BINARY} info > /dev/null 2>&1; then
echo "${BOLD}Docker or Podman is not running.${NC}" >&2
exit 1
fi
# Determine if Sail is currently up...
if "${COMPOSE_CMD[@]}" ps "$APP_SERVICE" 2>&1 | grep 'Exit\|exited'; then
echo "${BOLD}Shutting down old Sail processes...${NC}" >&2
"${COMPOSE_CMD[@]}" down > /dev/null 2>&1
EXEC="no"
elif [ -z "$("${COMPOSE_CMD[@]}" ps -q)" ]; then
EXEC="no"
fi
fi
ARGS=()
# Proxy PHP commands to the "php" binary on the application container...
if [ "$1" == "php" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" "php")
else
sail_is_not_running
fi
# Proxy vendor binary commands on the application container...
elif [ "$1" == "bin" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
CMD=$1
shift 1
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" ./vendor/bin/"$CMD")
else
sail_is_not_running
fi
# Proxy commands on the application container...
elif [ "$1" == "run" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
CMD=$1
shift 1
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" "$CMD")
else
sail_is_not_running
fi
# Proxy docker-compose commands to the docker-compose binary on the application container...
elif [ "$1" == "docker-compose" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" "${COMPOSE_CMD[@]}")
else
sail_is_not_running
fi
# Proxy Composer commands to the "composer" binary on the application container...
elif [ "$1" == "composer" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" "composer")
else
sail_is_not_running
fi
# Proxy Artisan commands to the "artisan" binary on the application container...
elif [ "$1" == "artisan" ] || [ "$1" == "art" ] || [ "$1" == "a" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" php artisan)
else
sail_is_not_running
fi
# Proxy the "debug" command to the "php artisan" binary on the application container with xdebug enabled...
elif [ "$1" == "debug" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER" -e XDEBUG_TRIGGER=1)
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" php artisan)
else
sail_is_not_running
fi
# Proxy the "test" command to the "php artisan test" Artisan command...
elif [ "$1" == "test" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" php artisan test)
else
sail_is_not_running
fi
# Proxy the "phpunit" command to "php vendor/bin/phpunit"...
elif [ "$1" == "phpunit" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" php vendor/bin/phpunit)
else
sail_is_not_running
fi
# Proxy the "pest" command to "php vendor/bin/pest"...
elif [ "$1" == "pest" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" php vendor/bin/pest)
else
sail_is_not_running
fi
# Proxy the "pint" command to "php vendor/bin/pint"...
elif [ "$1" == "pint" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" php vendor/bin/pint)
else
sail_is_not_running
fi
# Proxy the "dusk" command to the "php artisan dusk" Artisan command...
elif [ "$1" == "dusk" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=(-e "APP_URL=http://${APP_SERVICE}")
ARGS+=(-e "DUSK_DRIVER_URL=http://selenium:4444/wd/hub")
ARGS+=("$APP_SERVICE" php artisan dusk)
else
sail_is_not_running
fi
# Proxy the "dusk:fails" command to the "php artisan dusk:fails" Artisan command...
elif [ "$1" == "dusk:fails" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=(-e "APP_URL=http://${APP_SERVICE}")
ARGS+=(-e "DUSK_DRIVER_URL=http://selenium:4444/wd/hub")
ARGS+=("$APP_SERVICE" php artisan dusk:fails)
else
sail_is_not_running
fi
# Initiate a Laravel Tinker session within the application container...
elif [ "$1" == "tinker" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" php artisan tinker)
else
sail_is_not_running
fi
# Proxy Node commands to the "node" binary on the application container...
elif [ "$1" == "node" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" node)
else
sail_is_not_running
fi
# Proxy NPM commands to the "npm" binary on the application container...
elif [ "$1" == "npm" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" npm)
else
sail_is_not_running
fi
# Proxy NPX commands to the "npx" binary on the application container...
elif [ "$1" == "npx" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" npx)
else
sail_is_not_running
fi
# Proxy PNPM commands to the "pnpm" binary on the application container...
elif [ "$1" == "pnpm" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" pnpm)
else
sail_is_not_running
fi
# Proxy PNPX commands to the "pnpx" binary on the application container...
elif [ "$1" == "pnpx" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" pnpx)
else
sail_is_not_running
fi
# Proxy Yarn commands to the "yarn" binary on the application container...
elif [ "$1" == "yarn" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" yarn)
else
sail_is_not_running
fi
# Proxy Bun commands to the "bun" binary on the application container...
elif [ "$1" == "bun" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" bun)
else
sail_is_not_running
fi
# Proxy Bun X commands to the "bunx" binary on the application container...
elif [ "$1" == "bunx" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" bunx)
else
sail_is_not_running
fi
# Initiate a MySQL CLI terminal session within the "mysql" container...
elif [ "$1" == "mysql" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec)
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=(mysql bash -c)
ARGS+=("MYSQL_PWD=\${MYSQL_PASSWORD} mysql -u \${MYSQL_USER} \${MYSQL_DATABASE} \${MYSQL_EXTRA_OPTIONS}")
else
sail_is_not_running
fi
# Initiate a MySQL CLI terminal session within the "mariadb" container...
elif [ "$1" == "mariadb" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec)
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=(mariadb bash -c)
ARGS+=("MYSQL_PWD=\${MYSQL_PASSWORD} mariadb -u \${MYSQL_USER} \${MYSQL_DATABASE}")
else
sail_is_not_running
fi
# Initiate a PostgreSQL CLI terminal session within the "pgsql" container...
elif [ "$1" == "psql" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec)
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=(pgsql bash -c)
ARGS+=("PGPASSWORD=\${PGPASSWORD} psql -U \${POSTGRES_USER} \${POSTGRES_DB}")
else
sail_is_not_running
fi
# Initiate a Bash shell within the application container...
elif [ "$1" == "shell" ] || [ "$1" == "bash" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" bash)
else
sail_is_not_running
fi
# Initiate a root user Bash shell within the application container...
elif [ "$1" == "root-shell" ] || [ "$1" == "root-bash" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u root)
[ ! -t 0 ] && ARGS+=(-T)
forward_agent_env
ARGS+=("$APP_SERVICE" bash)
else
sail_is_not_running
fi
# Initiate a MongoDB Shell within the "mongodb" container...
elif [ "$1" == "mongodb" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec)
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=(mongodb mongosh --port "${FORWARD_MONGODB_PORT:-27017}" --username "$MONGODB_USERNAME" --password "$MONGODB_PASSWORD" --authenticationDatabase admin)
else
sail_is_not_running
fi
# Initiate a Redis CLI terminal session within the "redis" container...
elif [ "$1" == "redis" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec)
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=(redis redis-cli)
else
sail_is_not_running
fi
# Initiate a Valkey CLI terminal session within the "valkey" container...
elif [ "$1" == "valkey" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec)
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=(valkey valkey-cli)
else
sail_is_not_running
fi
# Share the site...
elif [ "$1" == "share" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
${SAIL_DOCKER_BINARY} run --init --rm --add-host=host.docker.internal:host-gateway -p "$SAIL_SHARE_DASHBOARD":4040 -t beyondcodegmbh/expose-server:latest share http://host.docker.internal:"$APP_PORT" \
--server-host="$SAIL_SHARE_SERVER_HOST" \
--server-port="$SAIL_SHARE_SERVER_PORT" \
--auth="$SAIL_SHARE_TOKEN" \
--server="$SAIL_SHARE_SERVER" \
--subdomain="$SAIL_SHARE_SUBDOMAIN" \
--domain="$SAIL_SHARE_DOMAIN" \
"$@"
exit
else
sail_is_not_running
fi
# Open the site...
elif [ "$1" == "open" ]; then
shift 1
if command -v open &>/dev/null; then
OPEN="open"
elif command -v xdg-open &>/dev/null; then
OPEN="xdg-open"
else
echo "Neither open nor xdg-open is available. Exiting."
exit 1
fi
if [ "$EXEC" == "yes" ]; then
if [[ -n "$APP_PORT" && "$APP_PORT" != "80" ]]; then
FULL_URL="${APP_URL}:${APP_PORT}"
else
FULL_URL="$APP_URL"
fi
$OPEN "$FULL_URL"
exit
else
sail_is_not_running
fi
fi
# Run Docker Compose with the defined arguments...
"${COMPOSE_CMD[@]}" "${ARGS[@]}" "$@"