This commit is contained in:
2025-05-12 14:25:25 +02:00
parent ab2db755ef
commit 9e378ca2b7
2719 changed files with 46505 additions and 60181 deletions

View File

@@ -1,15 +1,9 @@
<p align="center"><img src="https://github.com/laravel/sail/raw/HEAD/art/logo.svg" alt="Logo Laravel Sail"></p>
<p align="center"><img width="294" height="69" src="/art/logo.svg" alt="Logo Laravel Sail"></p>
<p align="center">
<a href="https://packagist.org/packages/laravel/sail">
<img src="https://img.shields.io/packagist/dt/laravel/sail" alt="Total Downloads">
</a>
<a href="https://packagist.org/packages/laravel/sail">
<img src="https://img.shields.io/packagist/v/laravel/sail" alt="Latest Stable Version">
</a>
<a href="https://packagist.org/packages/laravel/sail">
<img src="https://img.shields.io/packagist/l/laravel/sail" alt="License">
</a>
<a href="https://packagist.org/packages/laravel/sail"><img src="https://img.shields.io/packagist/dt/laravel/sail" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/sail"><img src="https://img.shields.io/packagist/v/laravel/sail" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/sail"><img src="https://img.shields.io/packagist/l/laravel/sail" alt="License"></a>
</p>
## Introduction

164
vendor/laravel/sail/bin/sail vendored Normal file → Executable file
View File

@@ -83,7 +83,9 @@ function display_help {
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"
@@ -110,6 +112,7 @@ function display_help {
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"
@@ -138,6 +141,7 @@ 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)}
@@ -210,9 +214,9 @@ if [ "$1" == "php" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" "php" "$@")
ARGS+=("$APP_SERVICE" "php")
else
sail_is_not_running
fi
@@ -222,9 +226,25 @@ elif [ "$1" == "bin" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
CMD=$1
shift 1
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" ./vendor/bin/"$@")
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)
ARGS+=("$APP_SERVICE" "$CMD")
else
sail_is_not_running
fi
@@ -234,7 +254,7 @@ elif [ "$1" == "docker-compose" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" "${DOCKER_COMPOSE[@]}")
else
@@ -246,9 +266,9 @@ elif [ "$1" == "composer" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" "composer" "$@")
ARGS+=("$APP_SERVICE" "composer")
else
sail_is_not_running
fi
@@ -258,9 +278,9 @@ elif [ "$1" == "artisan" ] || [ "$1" == "art" ] || [ "$1" == "a" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" php artisan "$@")
ARGS+=("$APP_SERVICE" php artisan)
else
sail_is_not_running
fi
@@ -270,9 +290,9 @@ elif [ "$1" == "debug" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail -e XDEBUG_SESSION=1)
ARGS+=(exec -u "$APP_USER" -e XDEBUG_TRIGGER=1)
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" php artisan "$@")
ARGS+=("$APP_SERVICE" php artisan)
else
sail_is_not_running
fi
@@ -282,9 +302,9 @@ elif [ "$1" == "test" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" php artisan test "$@")
ARGS+=("$APP_SERVICE" php artisan test)
else
sail_is_not_running
fi
@@ -294,9 +314,9 @@ elif [ "$1" == "phpunit" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" php vendor/bin/phpunit "$@")
ARGS+=("$APP_SERVICE" php vendor/bin/phpunit)
else
sail_is_not_running
fi
@@ -306,9 +326,9 @@ elif [ "$1" == "pest" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" php vendor/bin/pest "$@")
ARGS+=("$APP_SERVICE" php vendor/bin/pest)
else
sail_is_not_running
fi
@@ -318,9 +338,9 @@ elif [ "$1" == "pint" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" php vendor/bin/pint "$@")
ARGS+=("$APP_SERVICE" php vendor/bin/pint)
else
sail_is_not_running
fi
@@ -330,11 +350,11 @@ elif [ "$1" == "dusk" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=(-e "APP_URL=http://${APP_SERVICE}")
ARGS+=(-e "DUSK_DRIVER_URL=http://selenium:4444/wd/hub")
ARGS+=("$APP_SERVICE" php artisan dusk "$@")
ARGS+=("$APP_SERVICE" php artisan dusk)
else
sail_is_not_running
fi
@@ -344,21 +364,21 @@ elif [ "$1" == "dusk:fails" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=(-e "APP_URL=http://${APP_SERVICE}")
ARGS+=(-e "DUSK_DRIVER_URL=http://selenium:4444/wd/hub")
ARGS+=("$APP_SERVICE" php artisan dusk:fails "$@")
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
elif [ "$1" == "tinker" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" php artisan tinker)
else
@@ -370,9 +390,9 @@ elif [ "$1" == "node" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" node "$@")
ARGS+=("$APP_SERVICE" node)
else
sail_is_not_running
fi
@@ -382,9 +402,9 @@ elif [ "$1" == "npm" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" npm "$@")
ARGS+=("$APP_SERVICE" npm)
else
sail_is_not_running
fi
@@ -394,9 +414,9 @@ elif [ "$1" == "npx" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" npx "$@")
ARGS+=("$APP_SERVICE" npx)
else
sail_is_not_running
fi
@@ -406,9 +426,9 @@ elif [ "$1" == "pnpm" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" pnpm "$@")
ARGS+=("$APP_SERVICE" pnpm)
else
sail_is_not_running
fi
@@ -418,21 +438,21 @@ elif [ "$1" == "pnpx" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" pnpx "$@")
ARGS+=("$APP_SERVICE" pnpx)
else
sail_is_not_running
fi
# Proxy YARN commands to the "yarn" binary on the application container...
# Proxy Yarn commands to the "yarn" binary on the application container...
elif [ "$1" == "yarn" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" yarn "$@")
ARGS+=("$APP_SERVICE" yarn)
else
sail_is_not_running
fi
@@ -442,9 +462,9 @@ elif [ "$1" == "bun" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" bun "$@")
ARGS+=("$APP_SERVICE" bun)
else
sail_is_not_running
fi
@@ -454,9 +474,9 @@ elif [ "$1" == "bunx" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" bunx "$@")
ARGS+=("$APP_SERVICE" bunx)
else
sail_is_not_running
fi
@@ -482,7 +502,7 @@ elif [ "$1" == "mariadb" ]; then
ARGS+=(exec)
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=(mariadb bash -c)
ARGS+=("MYSQL_PWD=\${MYSQL_PASSWORD} mysql -u \${MYSQL_USER} \${MYSQL_DATABASE}")
ARGS+=("MYSQL_PWD=\${MYSQL_PASSWORD} mariadb -u \${MYSQL_USER} \${MYSQL_DATABASE}")
else
sail_is_not_running
fi
@@ -505,9 +525,9 @@ elif [ "$1" == "shell" ] || [ "$1" == "bash" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u sail)
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" bash "$@")
ARGS+=("$APP_SERVICE" bash)
else
sail_is_not_running
fi
@@ -519,13 +539,25 @@ elif [ "$1" == "root-shell" ] || [ "$1" == "root-bash" ]; then
if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u root)
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" bash "$@")
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
elif [ "$1" == "redis" ]; then
shift 1
if [ "$EXEC" == "yes" ]; then
@@ -536,12 +568,24 @@ elif [ "$1" == "redis" ] ; then
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
docker run --init --rm -p "$SAIL_SHARE_DASHBOARD":4040 -t beyondcodegmbh/expose-server:latest share http://host.docker.internal:"$APP_PORT" \
docker 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" \
@@ -559,18 +603,30 @@ elif [ "$1" == "share" ]; then
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
open "$APP_URL"
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
# Pass unknown commands to the "docker-compose" binary...
else
ARGS+=("$@")
fi
# Run Docker Compose with the defined arguments...
"${DOCKER_COMPOSE[@]}" "${ARGS[@]}"
"${DOCKER_COMPOSE[@]}" "${ARGS[@]}" "$@"

View File

@@ -15,11 +15,16 @@
],
"require": {
"php": "^8.0",
"illuminate/console": "^9.0|^10.0|^11.0",
"illuminate/contracts": "^9.0|^10.0|^11.0",
"illuminate/support": "^9.0|^10.0|^11.0",
"illuminate/console": "^9.52.16|^10.0|^11.0|^12.0",
"illuminate/contracts": "^9.52.16|^10.0|^11.0|^12.0",
"illuminate/support": "^9.52.16|^10.0|^11.0|^12.0",
"symfony/console": "^6.0|^7.0",
"symfony/yaml": "^6.0|^7.0"
},
"require-dev": {
"orchestra/testbench": "^7.0|^8.0|^9.0|^10.0",
"phpstan/phpstan": "^1.10"
},
"bin": [
"bin/sail"
],
@@ -29,9 +34,6 @@
}
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
},
"laravel": {
"providers": [
"Laravel\\Sail\\SailServiceProvider"
@@ -42,9 +44,5 @@
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"orchestra/testbench": "^7.0|^8.0|^9.0",
"phpstan/phpstan": "^1.10"
}
"prefer-stable": true
}

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
/usr/bin/mariadb --user=root --password="$MYSQL_ROOT_PASSWORD" <<-EOSQL
CREATE DATABASE IF NOT EXISTS testing;
GRANT ALL PRIVILEGES ON \`testing%\`.* TO '$MYSQL_USER'@'%';
EOSQL

0
vendor/laravel/sail/database/mysql/create-testing-database.sh vendored Normal file → Executable file
View File

View File

@@ -1,28 +1,33 @@
FROM ubuntu:20.04
FROM ubuntu:24.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=20
ARG POSTGRES_VERSION=13
ARG NODE_VERSION=22
ARG POSTGRES_VERSION=17
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
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"
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
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 python2 dnsutils librsvg2-bin fswatch \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /usr/share/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu focal main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& 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 /usr/share/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/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 php8.0-cli php8.0-dev \
php8.0-pgsql php8.0-sqlite3 php8.0-gd php8.0-imagick \
php8.0-curl php8.0-memcached \
php8.0-curl php8.0-memcached 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-pcov \
@@ -38,7 +43,7 @@ RUN apt-get update \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/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 /usr/share/keyrings/pgdg.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& echo "deb [signed-by=/usr/share/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 \
@@ -51,6 +56,7 @@ RUN update-alternatives --set php /usr/bin/php8.0
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
@@ -59,6 +65,6 @@ 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 8000
EXPOSE 80/tcp
ENTRYPOINT ["start-container"]

View File

@@ -2,6 +2,4 @@
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
[opcache]
opcache.enable_cli=1
pcov.directory = .

View File

@@ -1,5 +1,10 @@
#!/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
@@ -11,7 +16,11 @@ fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
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

View File

@@ -6,7 +6,7 @@ pidfile=/var/run/supervisord.pid
[program:php]
command=%(ENV_SUPERVISOR_PHP_COMMAND)s
user=sail
user=%(ENV_SUPERVISOR_PHP_USER)s
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0

View File

@@ -1,28 +1,33 @@
FROM ubuntu:22.04
FROM ubuntu:24.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=20
ARG POSTGRES_VERSION=15
ARG NODE_VERSION=22
ARG POSTGRES_VERSION=17
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
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"
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
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 python2 dnsutils librsvg2-bin fswatch \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /usr/share/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& 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 /usr/share/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/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 php8.1-cli php8.1-dev \
php8.1-pgsql php8.1-sqlite3 php8.1-gd php8.1-imagick \
php8.1-curl \
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 \
@@ -39,7 +44,7 @@ RUN apt-get update \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarn.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/yarn.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 /usr/share/keyrings/pgdg.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& echo "deb [signed-by=/usr/share/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 \
@@ -50,6 +55,7 @@ RUN apt-get update \
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
@@ -58,6 +64,6 @@ 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 8000
EXPOSE 80/tcp
ENTRYPOINT ["start-container"]

View File

@@ -2,6 +2,4 @@
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
[opcache]
opcache.enable_cli=1
pcov.directory = .

View File

@@ -1,5 +1,10 @@
#!/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
@@ -11,7 +16,11 @@ fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
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

View File

@@ -6,7 +6,7 @@ pidfile=/var/run/supervisord.pid
[program:php]
command=%(ENV_SUPERVISOR_PHP_COMMAND)s
user=sail
user=%(ENV_SUPERVISOR_PHP_USER)s
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0

View File

@@ -1,28 +1,33 @@
FROM ubuntu:22.04
FROM ubuntu:24.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=20
ARG POSTGRES_VERSION=15
ARG NODE_VERSION=22
ARG POSTGRES_VERSION=17
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
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"
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
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 python2 dnsutils librsvg2-bin fswatch \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | 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 jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& 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 php8.2-cli php8.2-dev \
php8.2-pgsql php8.2-sqlite3 php8.2-gd php8.2-imagick \
php8.2-curl \
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 \
@@ -40,7 +45,7 @@ RUN apt-get update \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /etc/apt/keyrings/yarn.gpg >/dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/yarn.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 jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& 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 \
@@ -51,6 +56,7 @@ RUN apt-get update \
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
@@ -59,6 +65,6 @@ 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 8000
EXPOSE 80/tcp
ENTRYPOINT ["start-container"]

View File

@@ -2,6 +2,4 @@
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
[opcache]
opcache.enable_cli=1
pcov.directory = .

View File

@@ -1,5 +1,10 @@
#!/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
@@ -11,7 +16,11 @@ fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
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

View File

@@ -6,7 +6,7 @@ pidfile=/var/run/supervisord.pid
[program:php]
command=%(ENV_SUPERVISOR_PHP_COMMAND)s
user=sail
user=%(ENV_SUPERVISOR_PHP_USER)s
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0

View File

@@ -1,34 +1,40 @@
FROM ubuntu:22.04
FROM ubuntu:24.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=20
ARG POSTGRES_VERSION=15
ARG NODE_VERSION=22
ARG MYSQL_CLIENT="mysql-client"
ARG POSTGRES_VERSION=17
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
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"
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
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 python2 dnsutils librsvg2-bin fswatch \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | 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 jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& 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 php8.3-cli php8.3-dev \
php8.3-pgsql php8.3-sqlite3 php8.3-gd \
php8.3-curl \
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 \
php8.3-msgpack php8.3-igbinary php8.3-redis \
php8.3-memcached php8.3-pcov php8.3-imagick php8.3-xdebug php8.3-swoole \
&& 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 \
@@ -40,10 +46,10 @@ RUN apt-get update \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /etc/apt/keyrings/yarn.gpg >/dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/yarn.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 jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& 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 $MYSQL_CLIENT \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
@@ -51,7 +57,8 @@ RUN apt-get update \
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.3
RUN groupadd --force -g $WWWGROUP sail
RUN userdel -r ubuntu
#RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
COPY start-container /usr/local/bin/start-container
@@ -59,6 +66,6 @@ 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 8000
EXPOSE 80/tcp
ENTRYPOINT ["start-container"]

View File

@@ -2,6 +2,4 @@
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
[opcache]
opcache.enable_cli=1
pcov.directory = .

View File

@@ -1,5 +1,10 @@
#!/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
@@ -11,7 +16,11 @@ fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
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

View File

@@ -6,7 +6,7 @@ pidfile=/var/run/supervisord.pid
[program:php]
command=%(ENV_SUPERVISOR_PHP_COMMAND)s
user=sail
user=%(ENV_SUPERVISOR_PHP_USER)s
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0

View File

@@ -0,0 +1,71 @@
FROM ubuntu:24.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=22
ARG MYSQL_CLIENT="mysql-client"
ARG POSTGRES_VERSION=17
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
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"
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 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 \
&& npm install -g pnpm \
&& npm install -g bun \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /etc/apt/keyrings/yarn.gpg >/dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/yarn.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.4
RUN userdel -r ubuntu
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
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"]

View File

@@ -0,0 +1,5 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
pcov.directory = .

View File

@@ -0,0 +1,26 @@
#!/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

View File

@@ -0,0 +1,14 @@
[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

View File

@@ -4,7 +4,9 @@ namespace Laravel\Sail\Console;
use Illuminate\Console\Command;
use Laravel\Sail\Console\Concerns\InteractsWithDockerComposeServices;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'sail:add')]
class AddCommand extends Command
{
use InteractsWithDockerComposeServices;
@@ -41,7 +43,7 @@ class AddCommand extends Command
}
if ($invalidServices = array_diff($services, $this->services)) {
$this->error('Invalid services ['.implode(',', $invalidServices).'].');
$this->components->error('Invalid services ['.implode(',', $invalidServices).'].');
return 1;
}
@@ -50,8 +52,9 @@ class AddCommand extends Command
$this->replaceEnvVariables($services);
$this->configurePhpUnit();
$this->info('Additional Sail services installed successfully.');
$this->prepareInstallation($services);
$this->output->writeln('');
$this->components->info('Additional Sail services installed successfully.');
}
}

View File

@@ -16,12 +16,15 @@ trait InteractsWithDockerComposeServices
'mysql',
'pgsql',
'mariadb',
'mongodb',
'redis',
'valkey',
'memcached',
'meilisearch',
'typesense',
'minio',
'mailpit',
'rabbitmq',
'selenium',
'soketi',
];
@@ -65,6 +68,11 @@ trait InteractsWithDockerComposeServices
? Yaml::parseFile($composePath)
: Yaml::parse(file_get_contents(__DIR__ . '/../../../stubs/docker-compose.stub'));
// Prepare the installation of the "mariadb-client" package if the MariaDB service is used...
if (in_array('mariadb', $services)) {
$compose['services']['laravel.test']['build']['args']['MYSQL_CLIENT'] = 'mariadb-client';
}
// Adds the new services as dependencies of the laravel.test service...
if (! array_key_exists('laravel.test', $compose['services'])) {
$this->warn('Couldn\'t find the laravel.test service. Make sure you add ['.implode(',', $services).'] to the depends_on config.');
@@ -87,7 +95,7 @@ trait InteractsWithDockerComposeServices
// Merge volumes...
collect($services)
->filter(function ($service) {
return in_array($service, ['mysql', 'pgsql', 'mariadb', 'redis', 'meilisearch', 'typesense', 'minio']);
return in_array($service, ['mysql', 'pgsql', 'mariadb', 'mongodb', 'redis', 'valkey', 'meilisearch', 'typesense', 'minio']);
})->filter(function ($service) use ($compose) {
return ! array_key_exists($service, $compose['volumes'] ?? []);
})->each(function ($service) use (&$compose) {
@@ -99,12 +107,11 @@ trait InteractsWithDockerComposeServices
unset($compose['volumes']);
}
// Replace Selenium with ARM base container on Apple Silicon...
if (in_array('selenium', $services) && in_array(php_uname('m'), ['arm64', 'aarch64'])) {
$compose['services']['selenium']['image'] = 'seleniarm/standalone-chromium';
}
$yaml = Yaml::dump($compose, Yaml::DUMP_OBJECT_AS_MAP);
file_put_contents($this->laravel->basePath('docker-compose.yml'), Yaml::dump($compose, Yaml::DUMP_OBJECT_AS_MAP));
$yaml = str_replace('{{PHP_VERSION}}', $this->hasOption('php') ? $this->option('php') : '8.4', $yaml);
file_put_contents($this->laravel->basePath('docker-compose.yml'), $yaml);
}
/**
@@ -141,6 +148,10 @@ trait InteractsWithDockerComposeServices
$environment = str_replace('DB_HOST=127.0.0.1', "DB_HOST=pgsql", $environment);
$environment = str_replace('DB_PORT=3306', "DB_PORT=5432", $environment);
} elseif (in_array('mariadb', $services)) {
if ($this->laravel->config->has('database.connections.mariadb')) {
$environment = preg_replace('/DB_CONNECTION=.*/', 'DB_CONNECTION=mariadb', $environment);
}
$environment = str_replace('DB_HOST=127.0.0.1', "DB_HOST=mariadb", $environment);
}
@@ -155,6 +166,15 @@ trait InteractsWithDockerComposeServices
$environment = str_replace('REDIS_HOST=127.0.0.1', 'REDIS_HOST=redis', $environment);
}
if (in_array('valkey',$services)){
$environment = str_replace('REDIS_HOST=127.0.0.1', 'REDIS_HOST=valkey', $environment);
}
if (in_array('mongodb', $services)) {
$environment .= "\nMONGODB_URI=mongodb://mongodb:27017";
$environment .= "\nMONGODB_DATABASE=laravel";
}
if (in_array('meilisearch', $services)) {
$environment .= "\nSCOUT_DRIVER=meilisearch";
$environment .= "\nMEILISEARCH_HOST=http://meilisearch:7700\n";
@@ -181,7 +201,13 @@ trait InteractsWithDockerComposeServices
}
if (in_array('mailpit', $services)) {
$environment = preg_replace("/^MAIL_MAILER=(.*)/m", "MAIL_MAILER=smtp", $environment);
$environment = preg_replace("/^MAIL_HOST=(.*)/m", "MAIL_HOST=mailpit", $environment);
$environment = preg_replace("/^MAIL_PORT=(.*)/m", "MAIL_PORT=1025", $environment);
}
if (in_array('rabbitmq', $services)) {
$environment = str_replace('RABBITMQ_HOST=127.0.0.1', 'RABBITMQ_HOST=rabbitmq', $environment);
}
file_put_contents($this->laravel->basePath('.env'), $environment);
@@ -205,7 +231,14 @@ trait InteractsWithDockerComposeServices
$phpunit = file_get_contents($path);
$phpunit = preg_replace('/^.*DB_CONNECTION.*\n/m', '', $phpunit);
$phpunit = str_replace('<!-- <env name="DB_DATABASE" value=":memory:"/> -->', '<env name="DB_DATABASE" value="testing"/>', $phpunit);
$phpunit = str_replace(
[
'<!-- <env name="DB_DATABASE" value=":memory:"/> -->',
'<env name="DB_DATABASE" value=":memory:"/>',
],
'<env name="DB_DATABASE" value="testing"/>',
$phpunit
);
file_put_contents($this->laravel->basePath('phpunit.xml'), $phpunit);
}
@@ -248,22 +281,14 @@ trait InteractsWithDockerComposeServices
}
if (count($services) > 0) {
$status = $this->runCommands([
$this->runCommands([
'./vendor/bin/sail pull '.implode(' ', $services),
]);
if ($status === 0) {
$this->info('Sail images installed successfully.');
}
}
$status = $this->runCommands([
$this->runCommands([
'./vendor/bin/sail build',
]);
if ($status === 0) {
$this->info('Sail build successful.');
}
}
/**

View File

@@ -4,8 +4,10 @@ namespace Laravel\Sail\Console;
use Illuminate\Console\Command;
use RuntimeException;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Process\Process;
#[AsCommand(name: 'sail:install')]
class InstallCommand extends Command
{
use Concerns\InteractsWithDockerComposeServices;
@@ -17,7 +19,8 @@ class InstallCommand extends Command
*/
protected $signature = 'sail:install
{--with= : The services that should be included in the installation}
{--devcontainer : Create a .devcontainer configuration directory}';
{--devcontainer : Create a .devcontainer configuration directory}
{--php=8.4 : The PHP version that should be used}';
/**
* The console command description.
@@ -42,7 +45,7 @@ class InstallCommand extends Command
}
if ($invalidServices = array_diff($services, $this->services)) {
$this->error('Invalid services ['.implode(',', $invalidServices).'].');
$this->components->error('Invalid services ['.implode(',', $invalidServices).'].');
return 1;
}
@@ -55,8 +58,21 @@ class InstallCommand extends Command
$this->installDevContainer();
}
$this->info('Sail scaffolding installed successfully.');
$this->prepareInstallation($services);
$this->output->writeln('');
$this->components->info('Sail scaffolding installed successfully. You may run your Docker containers using Sail\'s "up" command.');
$this->output->writeln('<fg=gray>➜</> <options=bold>./vendor/bin/sail up</>');
if (in_array('mysql', $services) ||
in_array('mariadb', $services) ||
in_array('pgsql', $services)) {
$this->components->warn('A database service was installed. Run "artisan migrate" to prepare your database:');
$this->output->writeln('<fg=gray>➜</> <options=bold>./vendor/bin/sail artisan migrate</>');
}
$this->output->writeln('');
}
}

View File

@@ -3,7 +3,9 @@
namespace Laravel\Sail\Console;
use Illuminate\Console\Command;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'sail:publish')]
class PublishCommand extends Command
{
/**
@@ -34,6 +36,7 @@ class PublishCommand extends Command
$this->laravel->basePath('docker-compose.yml'),
str_replace(
[
'./vendor/laravel/sail/runtimes/8.4',
'./vendor/laravel/sail/runtimes/8.3',
'./vendor/laravel/sail/runtimes/8.2',
'./vendor/laravel/sail/runtimes/8.1',
@@ -42,6 +45,7 @@ class PublishCommand extends Command
'./vendor/laravel/sail/database/pgsql'
],
[
'./docker/8.4',
'./docker/8.3',
'./docker/8.2',
'./docker/8.1',

View File

@@ -2,11 +2,11 @@
services:
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.3
context: ./vendor/laravel/sail/runtimes/{{PHP_VERSION}}
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.3/app
image: sail-{{PHP_VERSION}}/app
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:

View File

@@ -1,5 +1,5 @@
mariadb:
image: 'mariadb:10'
image: 'mariadb:11'
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
environment:
@@ -11,10 +11,10 @@ mariadb:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
volumes:
- 'sail-mariadb:/var/lib/mysql'
- './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
- './vendor/laravel/sail/database/mariadb/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
networks:
- sail
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
retries: 3
timeout: 5s

View File

@@ -9,6 +9,6 @@ meilisearch:
networks:
- sail
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--spider", "http://localhost:7700/health"]
test: ["CMD", "wget", "--no-verbose", "--spider", "http://127.0.0.1:7700/health"]
retries: 3
timeout: 5s

View File

@@ -7,11 +7,11 @@ minio:
MINIO_ROOT_USER: 'sail'
MINIO_ROOT_PASSWORD: 'password'
volumes:
- 'sail-minio:/data/minio'
- 'sail-minio:/data'
networks:
- sail
command: minio server /data/minio --console-address ":8900"
command: minio server /data --console-address ":8900"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
test: ["CMD", "mc", "ready", "local"]
retries: 3
timeout: 5s

19
vendor/laravel/sail/stubs/mongodb.stub vendored Normal file
View File

@@ -0,0 +1,19 @@
mongodb:
image: 'mongodb/mongodb-atlas-local:latest'
environment:
- MONGODB_INITDB_ROOT_USERNAME=${MONGODB_USERNAME:-}
- MONGODB_INITDB_ROOT_PASSWORD=${MONGODB_PASSWORD:-}
volumes:
- 'sail-mongodb:/data/db'
ports:
- '${FORWARD_MONGODB_PORT:-27017}:27017'
networks:
- sail
healthcheck:
test:
- CMD
- mongosh
- 'mongodb://localhost:27017/admin'
- '--eval=db.runCommand({ping:1})'
retries: 3
timeout: 5s

View File

@@ -1,5 +1,5 @@
pgsql:
image: 'postgres:15'
image: 'postgres:17'
ports:
- '${FORWARD_DB_PORT:-5432}:5432'
environment:

19
vendor/laravel/sail/stubs/rabbitmq.stub vendored Normal file
View File

@@ -0,0 +1,19 @@
rabbitmq:
image: 'rabbitmq:4-management'
ports:
- '${FORWARD_RABBITMQ_PORT:-5672}:5672'
- '${FORWARD_RABBITMQ_DASHBOARD_PORT:-15672}:15672'
environment:
RABBITMQ_HOST: "%"
RABBITMQ_USER: '${RABBITMQ_USER}'
RABBITMQ_PASSWORD: '${RABBITMQ_PASSWORD}'
RABBITMQ_VHOST: '${RABBITMQ_VHOST}'
RABBITMQ_QUEUE: '${RABBITMQ_QUEUE}'
volumes:
- 'sail-rabbitmq:/rabbitmq_data'
networks:
- sail
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
retries: 3
timeout: 5s

View File

@@ -1,5 +1,5 @@
selenium:
image: 'selenium/standalone-chrome'
image: 'selenium/standalone-chromium'
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes:

View File

@@ -1,5 +1,5 @@
typesense:
image: 'typesense/typesense:0.25.2'
image: 'typesense/typesense:27.1'
ports:
- '${FORWARD_TYPESENSE_PORT:-8108}:8108'
environment:
@@ -11,6 +11,6 @@ typesense:
networks:
- sail
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--spider", "http://localhost:8108/health"]
test: [CMD, bash, -c, "exec 3<>/dev/tcp/localhost/8108 && printf 'GET /health HTTP/1.1\\r\\nConnection: close\\r\\n\\r\\n' >&3 && head -n1 <&3 | grep '200' && exec 3>&-"]
retries: 5
timeout: 7s

12
vendor/laravel/sail/stubs/valkey.stub vendored Normal file
View File

@@ -0,0 +1,12 @@
valkey:
image: 'valkey/valkey:alpine'
ports:
- '${FORWARD_VALKEY_PORT:-6379}:6379'
volumes:
- 'sail-valkey:/data'
networks:
- sail
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
retries: 3
timeout: 5s