Browse Source

fail early when env var MYSQLDUMP_ARGS is not set

Fabian Peter Hammerle 3 years ago
parent
commit
f39cdced45
4 changed files with 9 additions and 2 deletions
  1. 1 0
      CHANGELOG.md
  2. 1 1
      Dockerfile
  3. 1 1
      docker-compose.yml
  4. 6 0
      entrypoint.sh

+ 1 - 0
CHANGELOG.md

@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Changed
 - `openssh-server`: listen on port `2200` (previously `2222`)
 - `docker-compose`: read-only container root filesystem
+- fail early when env var `MYSQLDUMP_ARGS` is not set
 
 ### Fixed
 - `Dockerfile` & `docker-compose`: add registry to base image specifiers for `podman`

+ 1 - 1
Dockerfile

@@ -19,7 +19,7 @@ VOLUME $SSHD_HOST_KEYS_DIR
 COPY sshd_config /etc/ssh/sshd_config
 EXPOSE 2200/tcp
 
-ENV MYSQLDUMP_ARGS --help
+ENV MYSQLDUMP_ARGS=
 COPY entrypoint.sh /
 ENTRYPOINT ["/sbin/tini", "--", "/entrypoint.sh"]
 

+ 1 - 1
docker-compose.yml

@@ -7,7 +7,7 @@ volumes:
 
 services:
   sample_database:
-    image: docker.io/mariadb:10.4
+    image: docker.io/mariadb:10.5.8
     environment:
       MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
       MYSQL_USER: someone

+ 6 - 0
entrypoint.sh

@@ -11,6 +11,12 @@ if [ ! -f "$SSHD_HOST_KEYS_DIR/ed25519" ]; then
 fi
 unset SSHD_HOST_KEYS_DIR
 
+if [ -z "$MYSQLDUMP_ARGS" ]; then
+    echo -e 'missing environment variable MYSQLDUMP_ARGS\n' >&2
+    set -x
+    mysqldump --help
+    exit 1
+fi
 echo -e "#!/bin/sh\nexec mysqldump $MYSQLDUMP_ARGS" > /tmp/mysqldump.sh
 chmod u+x /tmp/mysqldump.sh