Skip to content

Commit a469aa1

Browse files
authored
Include mysql-client and add DB_SSLMODE variable for forcing ssl on or off
The v1.12.0 update comes with two breaking changes to the Docker image. First error: Creating migration table ...................................... 16.96ms DONE INFO Loading stored database schemas. database/schema/mysql-schema.sql .............................. 15.18ms FAIL Process.php line 275: The command "mysql --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_L OAD_PASSWORD}" --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT} " --database="${:LARAVEL_LOAD_DATABASE}" < "${:LARAVEL_LOAD_PATH}"" failed. Exit Code: 127(Command not found) Working directory: /app Output: ================ Error Output: ================ sh: mysql: not found Second error: Once the mysql client is added to the image, a second error shows up if encryption is not enabled, as is the case for many single-node deployments where the database is an internal-only service: TLS/SSL error: SSL is required, but the server does not support it
1 parent 1a11462 commit a469aa1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Dockerfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ FROM --platform=$TARGETOS/$TARGETARCH php:8.3-fpm-alpine
1414
WORKDIR /app
1515
COPY . ./
1616
COPY --from=0 /app/public/assets ./public/assets
17-
RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip nginx libpng-dev libxml2-dev libzip-dev certbot certbot-nginx \
17+
RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip nginx libpng-dev libxml2-dev libzip-dev certbot certbot-nginx mysql-client \
1818
&& docker-php-ext-configure zip \
1919
&& docker-php-ext-install bcmath gd pdo_mysql zip \
2020
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
@@ -26,6 +26,14 @@ RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar un
2626
&& mkdir -p /app/storage/logs/ \
2727
&& chown -R nginx:nginx .
2828

29+
RUN rm -f /usr/bin/mysql \
30+
&& cat <<'EOF' > /usr/bin/mysql
31+
#!/bin/sh
32+
exec mariadb --ssl="${DB_SSLMODE}" "$@"
33+
EOF
34+
35+
RUN chmod +x /usr/bin/mysql
36+
2937
RUN rm /usr/local/etc/php-fpm.conf \
3038
&& echo "* * * * * /usr/local/bin/php /app/artisan schedule:run >> /dev/null 2>&1" >> /var/spool/cron/crontabs/root \
3139
&& echo "0 23 * * * certbot renew --nginx --quiet" >> /var/spool/cron/crontabs/root \

0 commit comments

Comments
 (0)