From 03573c088fc71bc9bd6a6e0b4af262935289621c Mon Sep 17 00:00:00 2001 From: pierreozoux Date: Wed, 19 Apr 2017 11:58:29 +0100 Subject: [PATCH] Give a deprecation warning when using the apk-install wrapper --- builder/scripts/apk-install | 8 ++++++++ docs/usage.md | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/builder/scripts/apk-install b/builder/scripts/apk-install index b0e0e08c..9ffa4f66 100755 --- a/builder/scripts/apk-install +++ b/builder/scripts/apk-install @@ -1,2 +1,10 @@ #!/bin/sh + +os_version = `cat /etc/os-release | grep VERSION_ID | cut -d= -f2` +version () { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } + +if [ $(version $os_version) -ge $(version "3.3.0") ]; then + echo "WARNING: this script is deprecated and would be removed in future version." + echo "If your alpine version is >= 3.3 Prefer the new way of doing it, and use --no-cache option" +fi apk add --update "$@" && rm -rf /var/cache/apk/* diff --git a/docs/usage.md b/docs/usage.md index 4ef97ff0..1cd10fac 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -45,12 +45,12 @@ CMD ["nginx", "-g", "daemon off;"] This avoids the need to use `--update` and remove `/var/cache/apk/*` when done installing packages. -## Convenience Cleanup +## Convenience Cleanup (For alpine <3.3) -The `gliderlabs` variant of this image contains a small unofficial wrapper script that assists in the cleanup of the package index after installing packages. A great minimalist cleans up after ones self. Thus, the `apk-install` script was born. Here is another simple `Dockerfile` that installs the `nginx` package and removes package index data: +The `gliderlabs` variant of this image contains a small unofficial wrapper script that assists in the cleanup of the package index after installing packages if you use alpine <3.3. A great minimalist cleans up after ones self. Thus, the `apk-install` script was born. Here is another simple `Dockerfile` that installs the `nginx` package and removes package index data: ``` -FROM gliderlabs/alpine:3.3 +FROM gliderlabs/alpine:3.2 RUN apk-install nginx