-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update YOURLS #16248
Update YOURLS #16248
Conversation
This comment has been minimized.
This comment has been minimized.
FROM php:8.3.2-apache We recommend that this stays as A few bits of feedback on the
|
Understood, I'll figure out how to revert to this. 👍
Indeed, after a second glance, I see it raises few concerns. |
@LeoColomb @yosifkit. For the last one, don't think only with a pure docker perspective, most docker users run their docks on a Kubernetes cluster and use Helm to do it. Normally, your dockerfile should be really tighten with capabilities proposed in the helm chart and inversely. You forked helm chart structure from Bitnami who is the biggest maintainer of helm charts and docker containers and they worked like that. When I tried to deploy for the first time yourls with your helm chart, I spent some time to find why my init custom script doesn't work. If you don't want to add some features to your dockerfile, don't put them in the helm chart because it will confuse users (like me) and discourage the less patient. I think your objective, as an opensource software maintainer, is to facilitate usage and adoption of yourls. |
96759c0
to
b406ebe
Compare
Diff for b406ebe:diff --git a/_bashbrew-cat b/_bashbrew-cat
index fa8037b..9979749 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -1,18 +1,18 @@
Maintainers: YOURLS <yourls@yourls.org> (@YOURLS), Léo Colombaro <git@colombaro.fr> (@LeoColomb)
-GitRepo: https://github.com/YOURLS/docker.git
+GitRepo: https://github.com/YOURLS/images.git
GitFetch: refs/heads/dist
Tags: 1.9.2-apache, 1.9-apache, 1-apache, apache, 1.9.2, 1.9, 1, latest
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 2ef3b5fe2539efd8dd876727376ddee2c22079b5
+GitCommit: 082820033f591498dbc30d4ffc0cc927197ebf26
Directory: apache
Tags: 1.9.2-fpm, 1.9-fpm, 1-fpm, fpm
Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 2ef3b5fe2539efd8dd876727376ddee2c22079b5
+GitCommit: 082820033f591498dbc30d4ffc0cc927197ebf26
Directory: fpm
Tags: 1.9.2-fpm-alpine, 1.9-fpm-alpine, 1-fpm-alpine, fpm-alpine
Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 2ef3b5fe2539efd8dd876727376ddee2c22079b5
+GitCommit: 082820033f591498dbc30d4ffc0cc927197ebf26
Directory: fpm-alpine
diff --git a/yourls_fpm-alpine/Dockerfile b/yourls_fpm-alpine/Dockerfile
index dc0e788..954f733 100644
--- a/yourls_fpm-alpine/Dockerfile
+++ b/yourls_fpm-alpine/Dockerfile
@@ -1,13 +1,4 @@
-FROM php:8.2-fpm-alpine
-
-LABEL org.opencontainers.image.title="YOURLS"
-LABEL org.opencontainers.image.description="Your Own URL Shortener"
-LABEL org.opencontainers.image.url="https://yourls.org/"
-LABEL org.opencontainers.image.documentation="https://yourls.org/"
-LABEL org.opencontainers.image.vendor="YOURLS Org"
-LABEL org.opencontainers.image.authors="YOURLS"
-LABEL org.opencontainers.image.licenses="MIT"
-LABEL io.artifacthub.package.readme-url="https://raw.githubusercontent.com/YOURLS/YOURLS/master/README.md"
+FROM php:8.3-fpm-alpine
# install the PHP extensions we need
RUN set -eux; \
@@ -29,8 +20,6 @@ RUN apk add --no-cache bash
ARG YOURLS_VERSION="1.9.2"
ARG YOURLS_SHA256="62a95ba766d62f3305d75944cbfe12d5a90c08c88fbf2f6e67150d36412b916f"
-LABEL org.opencontainers.image.version="$YOURLS_VERSION"
-
ENV YOURLS_VERSION=$YOURLS_VERSION
ENV YOURLS_SHA256=$YOURLS_SHA256
@@ -44,8 +33,8 @@ RUN set -eux; \
rm yourls.tar.gz; \
chown -R www-data:www-data /usr/src/yourls
-COPY --chown=www-data:www-data config-docker.php /usr/src/yourls/user/
-COPY docker-entrypoint.sh /usr/local/bin/
+COPY --chown=www-data:www-data config-container.php /usr/src/yourls/user/
+COPY container-entrypoint.sh /usr/local/bin/
-ENTRYPOINT ["docker-entrypoint.sh"]
+ENTRYPOINT ["container-entrypoint.sh"]
CMD ["php-fpm"]
diff --git a/yourls_latest/config-docker.php b/yourls_fpm-alpine/config-container.php
similarity index 85%
rename from yourls_latest/config-docker.php
rename to yourls_fpm-alpine/config-container.php
index cf56824..43d4302 100644
--- a/yourls_latest/config-docker.php
+++ b/yourls_fpm-alpine/config-container.php
@@ -4,8 +4,8 @@
*/
// a helper function to lookup "env_FILE", "env", then fallback
-if (!function_exists('getenv_docker')) {
- function getenv_docker(string $name, ?string $default = null): ?string
+if (!function_exists('getenv_container')) {
+ function getenv_container(string $name, ?string $default = null): ?string
{
if ($fileEnv = getenv($name . '_FILE')) {
return trim(file_get_contents($fileEnv));
@@ -23,20 +23,20 @@ if (!function_exists('getenv_docker')) {
*/
/** MySQL database username */
-define( 'YOURLS_DB_USER', getenv_docker('YOURLS_DB_USER', 'root') );
+define( 'YOURLS_DB_USER', getenv_container('YOURLS_DB_USER', 'root') );
/** MySQL database password */
-define( 'YOURLS_DB_PASS', getenv_docker('YOURLS_DB_PASS') );
+define( 'YOURLS_DB_PASS', getenv_container('YOURLS_DB_PASS') );
/** The name of the database for YOURLS */
-define( 'YOURLS_DB_NAME', getenv_docker('YOURLS_DB_NAME', 'yourls') );
+define( 'YOURLS_DB_NAME', getenv_container('YOURLS_DB_NAME', 'yourls') );
/** MySQL hostname.
** If using a non standard port, specify it like 'hostname:port', eg. 'localhost:9999' or '127.0.0.1:666' */
-define( 'YOURLS_DB_HOST', getenv_docker('YOURLS_DB_HOST', 'mysql') );
+define( 'YOURLS_DB_HOST', getenv_container('YOURLS_DB_HOST', 'mysql') );
/** MySQL tables prefix */
-define( 'YOURLS_DB_PREFIX', getenv_docker('YOURLS_DB_PREFIX', 'yourls_') );
+define( 'YOURLS_DB_PREFIX', getenv_container('YOURLS_DB_PREFIX', 'yourls_') );
/*
** Site options
@@ -44,7 +44,7 @@ define( 'YOURLS_DB_PREFIX', getenv_docker('YOURLS_DB_PREFIX', 'yourls_') );
/** YOURLS installation URL -- all lowercase, no trailing slash at the end.
** If you define it to "http://sho.rt", don't use "http://www.sho.rt" in your browser (and vice-versa) */
-define( 'YOURLS_SITE', getenv_docker('YOURLS_SITE', 'http://your-own-domain-here.com') );
+define( 'YOURLS_SITE', getenv_container('YOURLS_SITE', 'http://your-own-domain-here.com') );
/** Server timezone GMT offset */
define( 'YOURLS_HOURS_OFFSET', filter_var(getenv('YOURLS_HOURS_OFFSET'), FILTER_VALIDATE_INT) ?: 0 );
@@ -72,7 +72,7 @@ define( 'YOURLS_COOKIEKEY', getenv('YOURLS_COOKIEKEY') ?: 'modify this text with
** YOURLS will auto encrypt plain text passwords in this file
** Read http://yourls.org/userpassword for more information */
$yourls_user_passwords = [
- getenv_docker('YOURLS_USER') => getenv_docker('YOURLS_PASS'),
+ getenv_container('YOURLS_USER') => getenv_container('YOURLS_PASS'),
];
/** Debug mode to output some internal information
diff --git a/yourls_latest/docker-entrypoint.sh b/yourls_fpm-alpine/container-entrypoint.sh
similarity index 82%
rename from yourls_latest/docker-entrypoint.sh
rename to yourls_fpm-alpine/container-entrypoint.sh
index 8b65b17..b137360 100755
--- a/yourls_latest/docker-entrypoint.sh
+++ b/yourls_fpm-alpine/container-entrypoint.sh
@@ -72,12 +72,12 @@ if [[ "$1" == apache2* ]] || [ "$1" = 'php-fpm' ]; then
# We want to copy the initial config if the actual config file doesn't already
# exist OR if it is an empty file (e.g. it has been created for the volume mount).
if [ ! -s user/config.php ]; then
- cp /usr/src/yourls/user/config-docker.php user/config.php
+ cp /usr/src/yourls/user/config-container.php user/config.php
: "${YOURLS_USER:=}"
: "${YOURLS_PASS:=}"
if [ -n "${YOURLS_USER}" ] && [ -n "${YOURLS_PASS}" ]; then
- result=$(sed "s/ getenv_docker('YOURLS_USER') => getenv_docker('YOURLS_PASS'),/ \'${YOURLS_USER}\' => \'${YOURLS_PASS//&/\\&}\',/g" user/config.php)
+ result=$(sed "s/ getenv_container('YOURLS_USER') => getenv_container('YOURLS_PASS'),/ \'${YOURLS_USER}\' => \'${YOURLS_PASS//&/\\&}\',/g" user/config.php)
echo "$result" > user/config.php
fi
@@ -86,6 +86,26 @@ if [[ "$1" == apache2* ]] || [ "$1" = 'php-fpm' ]; then
# could be on a filesystem that doesn't allow chown (like some NFS setups)
chown "$user:$group" user/config.php || true
fi
+
+ # ability to use custom script
+ for file in /docker-entrypoint-init.d/*; do
+ echo >&2 "Running custom script $file"
+ case "$file" in
+ *.sh)
+ if [ -x "$file" ]; then
+ "$file" || exit 1
+ else
+ echo >&2 "... ignoring non-executable $file"
+ fi
+ ;;
+ *.php)
+ php -f "$file"
+ ;;
+ *)
+ echo >&2 "... ignoring $file"
+ ;;
+ esac
+ done
fi
fi
diff --git a/yourls_fpm/Dockerfile b/yourls_fpm/Dockerfile
index f12d542..7176d4e 100644
--- a/yourls_fpm/Dockerfile
+++ b/yourls_fpm/Dockerfile
@@ -1,13 +1,4 @@
-FROM php:8.2-fpm
-
-LABEL org.opencontainers.image.title="YOURLS"
-LABEL org.opencontainers.image.description="Your Own URL Shortener"
-LABEL org.opencontainers.image.url="https://yourls.org/"
-LABEL org.opencontainers.image.documentation="https://yourls.org/"
-LABEL org.opencontainers.image.vendor="YOURLS Org"
-LABEL org.opencontainers.image.authors="YOURLS"
-LABEL org.opencontainers.image.licenses="MIT"
-LABEL io.artifacthub.package.readme-url="https://raw.githubusercontent.com/YOURLS/YOURLS/master/README.md"
+FROM php:8.3-fpm
# install the PHP extensions we need
RUN set -eux; \
@@ -29,8 +20,6 @@ RUN { \
ARG YOURLS_VERSION="1.9.2"
ARG YOURLS_SHA256="62a95ba766d62f3305d75944cbfe12d5a90c08c88fbf2f6e67150d36412b916f"
-LABEL org.opencontainers.image.version="$YOURLS_VERSION"
-
ENV YOURLS_VERSION=$YOURLS_VERSION
ENV YOURLS_SHA256=$YOURLS_SHA256
@@ -44,8 +33,8 @@ RUN set -eux; \
rm yourls.tar.gz; \
chown -R www-data:www-data /usr/src/yourls
-COPY --chown=www-data:www-data config-docker.php /usr/src/yourls/user/
-COPY docker-entrypoint.sh /usr/local/bin/
+COPY --chown=www-data:www-data config-container.php /usr/src/yourls/user/
+COPY container-entrypoint.sh /usr/local/bin/
-ENTRYPOINT ["docker-entrypoint.sh"]
+ENTRYPOINT ["container-entrypoint.sh"]
CMD ["php-fpm"]
diff --git a/yourls_fpm-alpine/config-docker.php b/yourls_fpm/config-container.php
similarity index 85%
rename from yourls_fpm-alpine/config-docker.php
rename to yourls_fpm/config-container.php
index cf56824..43d4302 100644
--- a/yourls_fpm-alpine/config-docker.php
+++ b/yourls_fpm/config-container.php
@@ -4,8 +4,8 @@
*/
// a helper function to lookup "env_FILE", "env", then fallback
-if (!function_exists('getenv_docker')) {
- function getenv_docker(string $name, ?string $default = null): ?string
+if (!function_exists('getenv_container')) {
+ function getenv_container(string $name, ?string $default = null): ?string
{
if ($fileEnv = getenv($name . '_FILE')) {
return trim(file_get_contents($fileEnv));
@@ -23,20 +23,20 @@ if (!function_exists('getenv_docker')) {
*/
/** MySQL database username */
-define( 'YOURLS_DB_USER', getenv_docker('YOURLS_DB_USER', 'root') );
+define( 'YOURLS_DB_USER', getenv_container('YOURLS_DB_USER', 'root') );
/** MySQL database password */
-define( 'YOURLS_DB_PASS', getenv_docker('YOURLS_DB_PASS') );
+define( 'YOURLS_DB_PASS', getenv_container('YOURLS_DB_PASS') );
/** The name of the database for YOURLS */
-define( 'YOURLS_DB_NAME', getenv_docker('YOURLS_DB_NAME', 'yourls') );
+define( 'YOURLS_DB_NAME', getenv_container('YOURLS_DB_NAME', 'yourls') );
/** MySQL hostname.
** If using a non standard port, specify it like 'hostname:port', eg. 'localhost:9999' or '127.0.0.1:666' */
-define( 'YOURLS_DB_HOST', getenv_docker('YOURLS_DB_HOST', 'mysql') );
+define( 'YOURLS_DB_HOST', getenv_container('YOURLS_DB_HOST', 'mysql') );
/** MySQL tables prefix */
-define( 'YOURLS_DB_PREFIX', getenv_docker('YOURLS_DB_PREFIX', 'yourls_') );
+define( 'YOURLS_DB_PREFIX', getenv_container('YOURLS_DB_PREFIX', 'yourls_') );
/*
** Site options
@@ -44,7 +44,7 @@ define( 'YOURLS_DB_PREFIX', getenv_docker('YOURLS_DB_PREFIX', 'yourls_') );
/** YOURLS installation URL -- all lowercase, no trailing slash at the end.
** If you define it to "http://sho.rt", don't use "http://www.sho.rt" in your browser (and vice-versa) */
-define( 'YOURLS_SITE', getenv_docker('YOURLS_SITE', 'http://your-own-domain-here.com') );
+define( 'YOURLS_SITE', getenv_container('YOURLS_SITE', 'http://your-own-domain-here.com') );
/** Server timezone GMT offset */
define( 'YOURLS_HOURS_OFFSET', filter_var(getenv('YOURLS_HOURS_OFFSET'), FILTER_VALIDATE_INT) ?: 0 );
@@ -72,7 +72,7 @@ define( 'YOURLS_COOKIEKEY', getenv('YOURLS_COOKIEKEY') ?: 'modify this text with
** YOURLS will auto encrypt plain text passwords in this file
** Read http://yourls.org/userpassword for more information */
$yourls_user_passwords = [
- getenv_docker('YOURLS_USER') => getenv_docker('YOURLS_PASS'),
+ getenv_container('YOURLS_USER') => getenv_container('YOURLS_PASS'),
];
/** Debug mode to output some internal information
diff --git a/yourls_fpm/docker-entrypoint.sh b/yourls_fpm/container-entrypoint.sh
similarity index 82%
rename from yourls_fpm/docker-entrypoint.sh
rename to yourls_fpm/container-entrypoint.sh
index 8b65b17..b137360 100755
--- a/yourls_fpm/docker-entrypoint.sh
+++ b/yourls_fpm/container-entrypoint.sh
@@ -72,12 +72,12 @@ if [[ "$1" == apache2* ]] || [ "$1" = 'php-fpm' ]; then
# We want to copy the initial config if the actual config file doesn't already
# exist OR if it is an empty file (e.g. it has been created for the volume mount).
if [ ! -s user/config.php ]; then
- cp /usr/src/yourls/user/config-docker.php user/config.php
+ cp /usr/src/yourls/user/config-container.php user/config.php
: "${YOURLS_USER:=}"
: "${YOURLS_PASS:=}"
if [ -n "${YOURLS_USER}" ] && [ -n "${YOURLS_PASS}" ]; then
- result=$(sed "s/ getenv_docker('YOURLS_USER') => getenv_docker('YOURLS_PASS'),/ \'${YOURLS_USER}\' => \'${YOURLS_PASS//&/\\&}\',/g" user/config.php)
+ result=$(sed "s/ getenv_container('YOURLS_USER') => getenv_container('YOURLS_PASS'),/ \'${YOURLS_USER}\' => \'${YOURLS_PASS//&/\\&}\',/g" user/config.php)
echo "$result" > user/config.php
fi
@@ -86,6 +86,26 @@ if [[ "$1" == apache2* ]] || [ "$1" = 'php-fpm' ]; then
# could be on a filesystem that doesn't allow chown (like some NFS setups)
chown "$user:$group" user/config.php || true
fi
+
+ # ability to use custom script
+ for file in /docker-entrypoint-init.d/*; do
+ echo >&2 "Running custom script $file"
+ case "$file" in
+ *.sh)
+ if [ -x "$file" ]; then
+ "$file" || exit 1
+ else
+ echo >&2 "... ignoring non-executable $file"
+ fi
+ ;;
+ *.php)
+ php -f "$file"
+ ;;
+ *)
+ echo >&2 "... ignoring $file"
+ ;;
+ esac
+ done
fi
fi
diff --git a/yourls_latest/Dockerfile b/yourls_latest/Dockerfile
index ba4fafc..ef27f6e 100644
--- a/yourls_latest/Dockerfile
+++ b/yourls_latest/Dockerfile
@@ -1,13 +1,4 @@
-FROM php:8.2-apache
-
-LABEL org.opencontainers.image.title="YOURLS"
-LABEL org.opencontainers.image.description="Your Own URL Shortener"
-LABEL org.opencontainers.image.url="https://yourls.org/"
-LABEL org.opencontainers.image.documentation="https://yourls.org/"
-LABEL org.opencontainers.image.vendor="YOURLS Org"
-LABEL org.opencontainers.image.authors="YOURLS"
-LABEL org.opencontainers.image.licenses="MIT"
-LABEL io.artifacthub.package.readme-url="https://raw.githubusercontent.com/YOURLS/YOURLS/master/README.md"
+FROM php:8.3-apache
# install the PHP extensions we need
RUN set -eux; \
@@ -29,8 +20,6 @@ RUN a2enmod rewrite expires
ARG YOURLS_VERSION="1.9.2"
ARG YOURLS_SHA256="62a95ba766d62f3305d75944cbfe12d5a90c08c88fbf2f6e67150d36412b916f"
-LABEL org.opencontainers.image.version="$YOURLS_VERSION"
-
ENV YOURLS_VERSION=$YOURLS_VERSION
ENV YOURLS_SHA256=$YOURLS_SHA256
@@ -44,8 +33,8 @@ RUN set -eux; \
rm yourls.tar.gz; \
chown -R www-data:www-data /usr/src/yourls
-COPY --chown=www-data:www-data config-docker.php /usr/src/yourls/user/
-COPY docker-entrypoint.sh /usr/local/bin/
+COPY --chown=www-data:www-data config-container.php /usr/src/yourls/user/
+COPY container-entrypoint.sh /usr/local/bin/
COPY .htaccess /usr/src/yourls/
-ENTRYPOINT ["docker-entrypoint.sh"]
+ENTRYPOINT ["container-entrypoint.sh"]
CMD ["apache2-foreground"]
diff --git a/yourls_fpm/config-docker.php b/yourls_latest/config-container.php
similarity index 85%
rename from yourls_fpm/config-docker.php
rename to yourls_latest/config-container.php
index cf56824..43d4302 100644
--- a/yourls_fpm/config-docker.php
+++ b/yourls_latest/config-container.php
@@ -4,8 +4,8 @@
*/
// a helper function to lookup "env_FILE", "env", then fallback
-if (!function_exists('getenv_docker')) {
- function getenv_docker(string $name, ?string $default = null): ?string
+if (!function_exists('getenv_container')) {
+ function getenv_container(string $name, ?string $default = null): ?string
{
if ($fileEnv = getenv($name . '_FILE')) {
return trim(file_get_contents($fileEnv));
@@ -23,20 +23,20 @@ if (!function_exists('getenv_docker')) {
*/
/** MySQL database username */
-define( 'YOURLS_DB_USER', getenv_docker('YOURLS_DB_USER', 'root') );
+define( 'YOURLS_DB_USER', getenv_container('YOURLS_DB_USER', 'root') );
/** MySQL database password */
-define( 'YOURLS_DB_PASS', getenv_docker('YOURLS_DB_PASS') );
+define( 'YOURLS_DB_PASS', getenv_container('YOURLS_DB_PASS') );
/** The name of the database for YOURLS */
-define( 'YOURLS_DB_NAME', getenv_docker('YOURLS_DB_NAME', 'yourls') );
+define( 'YOURLS_DB_NAME', getenv_container('YOURLS_DB_NAME', 'yourls') );
/** MySQL hostname.
** If using a non standard port, specify it like 'hostname:port', eg. 'localhost:9999' or '127.0.0.1:666' */
-define( 'YOURLS_DB_HOST', getenv_docker('YOURLS_DB_HOST', 'mysql') );
+define( 'YOURLS_DB_HOST', getenv_container('YOURLS_DB_HOST', 'mysql') );
/** MySQL tables prefix */
-define( 'YOURLS_DB_PREFIX', getenv_docker('YOURLS_DB_PREFIX', 'yourls_') );
+define( 'YOURLS_DB_PREFIX', getenv_container('YOURLS_DB_PREFIX', 'yourls_') );
/*
** Site options
@@ -44,7 +44,7 @@ define( 'YOURLS_DB_PREFIX', getenv_docker('YOURLS_DB_PREFIX', 'yourls_') );
/** YOURLS installation URL -- all lowercase, no trailing slash at the end.
** If you define it to "http://sho.rt", don't use "http://www.sho.rt" in your browser (and vice-versa) */
-define( 'YOURLS_SITE', getenv_docker('YOURLS_SITE', 'http://your-own-domain-here.com') );
+define( 'YOURLS_SITE', getenv_container('YOURLS_SITE', 'http://your-own-domain-here.com') );
/** Server timezone GMT offset */
define( 'YOURLS_HOURS_OFFSET', filter_var(getenv('YOURLS_HOURS_OFFSET'), FILTER_VALIDATE_INT) ?: 0 );
@@ -72,7 +72,7 @@ define( 'YOURLS_COOKIEKEY', getenv('YOURLS_COOKIEKEY') ?: 'modify this text with
** YOURLS will auto encrypt plain text passwords in this file
** Read http://yourls.org/userpassword for more information */
$yourls_user_passwords = [
- getenv_docker('YOURLS_USER') => getenv_docker('YOURLS_PASS'),
+ getenv_container('YOURLS_USER') => getenv_container('YOURLS_PASS'),
];
/** Debug mode to output some internal information
diff --git a/yourls_fpm-alpine/docker-entrypoint.sh b/yourls_latest/container-entrypoint.sh
similarity index 82%
rename from yourls_fpm-alpine/docker-entrypoint.sh
rename to yourls_latest/container-entrypoint.sh
index 8b65b17..b137360 100755
--- a/yourls_fpm-alpine/docker-entrypoint.sh
+++ b/yourls_latest/container-entrypoint.sh
@@ -72,12 +72,12 @@ if [[ "$1" == apache2* ]] || [ "$1" = 'php-fpm' ]; then
# We want to copy the initial config if the actual config file doesn't already
# exist OR if it is an empty file (e.g. it has been created for the volume mount).
if [ ! -s user/config.php ]; then
- cp /usr/src/yourls/user/config-docker.php user/config.php
+ cp /usr/src/yourls/user/config-container.php user/config.php
: "${YOURLS_USER:=}"
: "${YOURLS_PASS:=}"
if [ -n "${YOURLS_USER}" ] && [ -n "${YOURLS_PASS}" ]; then
- result=$(sed "s/ getenv_docker('YOURLS_USER') => getenv_docker('YOURLS_PASS'),/ \'${YOURLS_USER}\' => \'${YOURLS_PASS//&/\\&}\',/g" user/config.php)
+ result=$(sed "s/ getenv_container('YOURLS_USER') => getenv_container('YOURLS_PASS'),/ \'${YOURLS_USER}\' => \'${YOURLS_PASS//&/\\&}\',/g" user/config.php)
echo "$result" > user/config.php
fi
@@ -86,6 +86,26 @@ if [[ "$1" == apache2* ]] || [ "$1" = 'php-fpm' ]; then
# could be on a filesystem that doesn't allow chown (like some NFS setups)
chown "$user:$group" user/config.php || true
fi
+
+ # ability to use custom script
+ for file in /docker-entrypoint-init.d/*; do
+ echo >&2 "Running custom script $file"
+ case "$file" in
+ *.sh)
+ if [ -x "$file" ]; then
+ "$file" || exit 1
+ else
+ echo >&2 "... ignoring non-executable $file"
+ fi
+ ;;
+ *.php)
+ php -f "$file"
+ ;;
+ *)
+ echo >&2 "... ignoring $file"
+ ;;
+ esac
+ done
fi
fi Relevant Maintainers:
|
@yosifkit Content updated based on your review. Thanks again 😊 |
Automated changes from YOURLS/images via GitHub Actions run #4336679159.