Skip to content
Snippets Groups Projects
Commit e36b4f57 authored by Konstantin Pavlov's avatar Konstantin Pavlov
Browse files

Introduced entrypoint

This allows to launch configuration scripts on the start of container.
parent 1acd7f69
Branches
Tags
No related merge requests found
Showing
with 296 additions and 8 deletions
......@@ -107,7 +107,12 @@ RUN set -x \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
# make default server listen on ipv6
&& sed -i -E 's,listen 80;,listen 80;\n listen [::]:80;,' \
/etc/nginx/conf.d/default.conf
/etc/nginx/conf.d/default.conf \
# create a docker-entrypoint.d directory
&& mkdir /docker-entrypoint.d
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 80
......
#!/usr/bin/env sh
# vim:sw=4:ts=4:et
set -e
if [ "$1" = "nginx" ]; then
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -print -quit 2>/dev/null | /bin/grep -q .; then
echo "$0: /docker-entrypoint.d/ is not empty, will attempt to perform an initial configuration"
echo "$0: Looking for shell scripts in /docker-entrypoint.d/"
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.sh" -executable | sort -n); do
echo "$0: Launching $f";
"$f"
done
# warn on shell scripts without exec bit
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.sh" -not -executable); do
echo "$0: Ignoring $f, not executable";
done
# warn on filetypes we don't know what to do with
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -not -name "*.sh"); do
echo "$0: Ignoring $f";
done
echo "$0: Initial configuration complete; ready for start up"
else
echo "$0: /docker-entrypoint.d/ is empty, skipping initial configuration"
fi
fi
exec "$@"
......@@ -106,7 +106,12 @@ RUN set -x \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
# make default server listen on ipv6
&& sed -i -E 's,listen 80;,listen 80;\n listen [::]:80;,' \
/etc/nginx/conf.d/default.conf
/etc/nginx/conf.d/default.conf \
# create a docker-entrypoint.d directory
&& mkdir /docker-entrypoint.d
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 80
......
#!/usr/bin/env sh
# vim:sw=4:ts=4:et
set -e
if [ "$1" = "nginx" ]; then
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -print -quit 2>/dev/null | /bin/grep -q .; then
echo "$0: /docker-entrypoint.d/ is not empty, will attempt to perform an initial configuration"
echo "$0: Looking for shell scripts in /docker-entrypoint.d/"
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.sh" -executable | sort -n); do
echo "$0: Launching $f";
"$f"
done
# warn on shell scripts without exec bit
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.sh" -not -executable); do
echo "$0: Ignoring $f, not executable";
done
# warn on filetypes we don't know what to do with
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -not -name "*.sh"); do
echo "$0: Ignoring $f";
done
echo "$0: Initial configuration complete; ready for start up"
else
echo "$0: /docker-entrypoint.d/ is empty, skipping initial configuration"
fi
fi
exec "$@"
......@@ -98,7 +98,12 @@ RUN set -x \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
# make default server listen on ipv6
&& sed -i -E 's,listen 80;,listen 80;\n listen [::]:80;,' \
/etc/nginx/conf.d/default.conf
/etc/nginx/conf.d/default.conf \
# create a docker-entrypoint.d directory
&& mkdir /docker-entrypoint.d
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 80
......
#!/usr/bin/env sh
# vim:sw=4:ts=4:et
set -e
if [ "$1" = "nginx" ]; then
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -print -quit 2>/dev/null | /bin/grep -q .; then
echo "$0: /docker-entrypoint.d/ is not empty, will attempt to perform an initial configuration"
echo "$0: Looking for shell scripts in /docker-entrypoint.d/"
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.sh" -executable | sort -n); do
echo "$0: Launching $f";
"$f"
done
# warn on shell scripts without exec bit
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.sh" -not -executable); do
echo "$0: Ignoring $f, not executable";
done
# warn on filetypes we don't know what to do with
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -not -name "*.sh"); do
echo "$0: Ignoring $f";
done
echo "$0: Initial configuration complete; ready for start up"
else
echo "$0: /docker-entrypoint.d/ is empty, skipping initial configuration"
fi
fi
exec "$@"
......@@ -97,7 +97,12 @@ RUN set -x \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
# make default server listen on ipv6
&& sed -i -E 's,listen 80;,listen 80;\n listen [::]:80;,' \
/etc/nginx/conf.d/default.conf
/etc/nginx/conf.d/default.conf \
# create a docker-entrypoint.d directory
&& mkdir /docker-entrypoint.d
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 80
......
#!/usr/bin/env sh
# vim:sw=4:ts=4:et
set -e
if [ "$1" = "nginx" ]; then
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -print -quit 2>/dev/null | /bin/grep -q .; then
echo "$0: /docker-entrypoint.d/ is not empty, will attempt to perform an initial configuration"
echo "$0: Looking for shell scripts in /docker-entrypoint.d/"
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.sh" -executable | sort -n); do
echo "$0: Launching $f";
"$f"
done
# warn on shell scripts without exec bit
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.sh" -not -executable); do
echo "$0: Ignoring $f, not executable";
done
# warn on filetypes we don't know what to do with
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -not -name "*.sh"); do
echo "$0: Ignoring $f";
done
echo "$0: Initial configuration complete; ready for start up"
else
echo "$0: /docker-entrypoint.d/ is empty, skipping initial configuration"
fi
fi
exec "$@"
......@@ -107,7 +107,12 @@ RUN set -x \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
# make default server listen on ipv6
&& sed -i -E 's,listen 80;,listen 80;\n listen [::]:80;,' \
/etc/nginx/conf.d/default.conf
/etc/nginx/conf.d/default.conf \
# create a docker-entrypoint.d directory
&& mkdir /docker-entrypoint.d
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 80
......
#!/usr/bin/env sh
# vim:sw=4:ts=4:et
set -e
if [ "$1" = "nginx" ]; then
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -print -quit 2>/dev/null | /bin/grep -q .; then
echo "$0: /docker-entrypoint.d/ is not empty, will attempt to perform an initial configuration"
echo "$0: Looking for shell scripts in /docker-entrypoint.d/"
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.sh" -executable | sort -n); do
echo "$0: Launching $f";
"$f"
done
# warn on shell scripts without exec bit
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.sh" -not -executable); do
echo "$0: Ignoring $f, not executable";
done
# warn on filetypes we don't know what to do with
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -not -name "*.sh"); do
echo "$0: Ignoring $f";
done
echo "$0: Initial configuration complete; ready for start up"
else
echo "$0: /docker-entrypoint.d/ is empty, skipping initial configuration"
fi
fi
exec "$@"
......@@ -106,7 +106,12 @@ RUN set -x \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
# make default server listen on ipv6
&& sed -i -E 's,listen 80;,listen 80;\n listen [::]:80;,' \
/etc/nginx/conf.d/default.conf
/etc/nginx/conf.d/default.conf \
# create a docker-entrypoint.d directory
&& mkdir /docker-entrypoint.d
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 80
......
#!/usr/bin/env sh
# vim:sw=4:ts=4:et
set -e
if [ "$1" = "nginx" ]; then
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -print -quit 2>/dev/null | /bin/grep -q .; then
echo "$0: /docker-entrypoint.d/ is not empty, will attempt to perform an initial configuration"
echo "$0: Looking for shell scripts in /docker-entrypoint.d/"
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.sh" -executable | sort -n); do
echo "$0: Launching $f";
"$f"
done
# warn on shell scripts without exec bit
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.sh" -not -executable); do
echo "$0: Ignoring $f, not executable";
done
# warn on filetypes we don't know what to do with
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -not -name "*.sh"); do
echo "$0: Ignoring $f";
done
echo "$0: Initial configuration complete; ready for start up"
else
echo "$0: /docker-entrypoint.d/ is empty, skipping initial configuration"
fi
fi
exec "$@"
......@@ -98,7 +98,12 @@ RUN set -x \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
# make default server listen on ipv6
&& sed -i -E 's,listen 80;,listen 80;\n listen [::]:80;,' \
/etc/nginx/conf.d/default.conf
/etc/nginx/conf.d/default.conf \
# create a docker-entrypoint.d directory
&& mkdir /docker-entrypoint.d
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 80
......
#!/usr/bin/env sh
# vim:sw=4:ts=4:et
set -e
if [ "$1" = "nginx" ]; then
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -print -quit 2>/dev/null | /bin/grep -q .; then
echo "$0: /docker-entrypoint.d/ is not empty, will attempt to perform an initial configuration"
echo "$0: Looking for shell scripts in /docker-entrypoint.d/"
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.sh" -executable | sort -n); do
echo "$0: Launching $f";
"$f"
done
# warn on shell scripts without exec bit
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.sh" -not -executable); do
echo "$0: Ignoring $f, not executable";
done
# warn on filetypes we don't know what to do with
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -not -name "*.sh"); do
echo "$0: Ignoring $f";
done
echo "$0: Initial configuration complete; ready for start up"
else
echo "$0: /docker-entrypoint.d/ is empty, skipping initial configuration"
fi
fi
exec "$@"
......@@ -97,7 +97,12 @@ RUN set -x \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
# make default server listen on ipv6
&& sed -i -E 's,listen 80;,listen 80;\n listen [::]:80;,' \
/etc/nginx/conf.d/default.conf
/etc/nginx/conf.d/default.conf \
# create a docker-entrypoint.d directory
&& mkdir /docker-entrypoint.d
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 80
......
#!/usr/bin/env sh
# vim:sw=4:ts=4:et
set -e
if [ "$1" = "nginx" ]; then
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -print -quit 2>/dev/null | /bin/grep -q .; then
echo "$0: /docker-entrypoint.d/ is not empty, will attempt to perform an initial configuration"
echo "$0: Looking for shell scripts in /docker-entrypoint.d/"
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.sh" -executable | sort -n); do
echo "$0: Launching $f";
"$f"
done
# warn on shell scripts without exec bit
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -name "*.sh" -not -executable); do
echo "$0: Ignoring $f, not executable";
done
# warn on filetypes we don't know what to do with
for f in $(/usr/bin/find /docker-entrypoint.d/ -type f -not -name "*.sh"); do
echo "$0: Ignoring $f";
done
echo "$0: Initial configuration complete; ready for start up"
else
echo "$0: /docker-entrypoint.d/ is empty, skipping initial configuration"
fi
fi
exec "$@"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment