Simplify the management of alpine version

Standardizes the alpine version to use and helps upgrade the alpine version only on version update
This commit is contained in:
Laurent Goderre 2018-05-17 14:06:58 -04:00
parent 4166cc4894
commit 9bd00c484c
3 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
FROM alpine:3.4
FROM alpine:0.0
ENV NODE_VERSION 0.0.0

1
config
View File

@ -1 +1,2 @@
baseuri https://nodejs.org/dist
alpine_version 3.7

View File

@ -42,7 +42,7 @@ function update_node_version() {
shift
local dockerfile=$1
shift
local variant
local variant=""
if [ $# -eq 1 ]; then
variant=$1
shift
@ -73,10 +73,9 @@ function update_node_version() {
sed -Ei -e "/${pattern}/d" "${dockerfile}"
done
if [ "${version/.*/}" -ge 10 ]; then
sed -Ei -e 's/FROM (.*)alpine:3.4/FROM \1alpine:3.7/' "${dockerfile}"
elif [ "${version/.*/}" -ge 8 ] || [ "$arch" = "ppc64le" ] || [ "$arch" = "s390x" ] || [ "$arch" == "arm64" ] || [ "$arch" == "arm32v7" ]; then
sed -Ei -e 's/FROM (.*)alpine:3.4/FROM \1alpine:3.6/' "${dockerfile}"
if [ "${variant}" = "alpine" ]; then
alpine_version=$(get_config "./" "alpine_version")
sed -Ei "s/(alpine:)0.0/\\1${alpine_version}/" "${dockerfile}"
fi
)
}