Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
- stage: Build
env:
- NODE_VERSION: "10"
- VARIANT: "default"
- VARIANT: "jessie"

- stage: Build
env:
Expand All @@ -107,7 +107,7 @@ jobs:
- stage: Build
env:
- NODE_VERSION: "6"
- VARIANT: "default"
- VARIANT: "jessie"

- stage: Build
env:
Expand All @@ -132,7 +132,7 @@ jobs:
- stage: Build
env:
- NODE_VERSION: "8"
- VARIANT: "default"
- VARIANT: "jessie"

- stage: Build
env:
Expand All @@ -157,7 +157,7 @@ jobs:
- stage: Build
env:
- NODE_VERSION: "9"
- VARIANT: "default"
- VARIANT: "jessie"

- stage: Build
env:
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions 6/architectures
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bashbrew-arch variants
arm32v7 default,onbuild,slim,stretch
arm64v8 default,onbuild,slim,stretch
amd64 default,alpine,onbuild,slim,stretch
i386 default,onbuild,slim,stretch
ppc64le default,onbuild,slim,stretch
s390x default,onbuild,slim,stretch
arm32v7 jessie,onbuild,slim,stretch
arm64v8 jessie,onbuild,slim,stretch
amd64 jessie,alpine,onbuild,slim,stretch
i386 jessie,onbuild,slim,stretch
ppc64le jessie,onbuild,slim,stretch
s390x jessie,onbuild,slim,stretch
File renamed without changes.
2 changes: 1 addition & 1 deletion 6/onbuild/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:6.14.2
FROM node:6.14.2-jessie

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion 8/onbuild/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:8.11.2
FROM node:8.11.2-jessie

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion 9/onbuild/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:9.11.1
FROM node:9.11.1-jessie

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion Dockerfile-onbuild.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:0.0.0
FROM node:0.0.0-jessie

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
Expand Down
12 changes: 6 additions & 6 deletions architectures
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
bashbrew-arch variants
arm32v6 alpine
arm32v7 default,onbuild,slim,stretch
arm64v8 default,alpine,onbuild,slim,stretch
amd64 default,alpine,onbuild,slim,stretch
i386 default,alpine,onbuild,slim,stretch
ppc64le default,alpine,onbuild,slim,stretch
s390x default,alpine,onbuild,slim,stretch
arm32v7 jessie,onbuild,slim,stretch
arm64v8 jessie,alpine,onbuild,slim,stretch
amd64 jessie,alpine,onbuild,slim,stretch
i386 jessie,alpine,onbuild,slim,stretch
ppc64le jessie,alpine,onbuild,slim,stretch
s390x jessie,alpine,onbuild,slim,stretch
1 change: 1 addition & 0 deletions config
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
baseuri https://nodejs.org/dist
default_variant jessie
alpine_version 3.7
14 changes: 12 additions & 2 deletions functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ function get_versions() {

local versions
local dirs=("$@")

local default_variant
default_variant=$(get_config "./" "default_variant")
if [ ${#dirs[@]} -eq 0 ]; then
IFS=' ' read -ra dirs <<<"$(echo "${prefix%/}/"*/)"
fi
Expand All @@ -156,7 +159,7 @@ function get_versions() {
for subdir in "${subdirs[@]}"; do
versions+=("${subdir}")
done
elif [ -a "${dir}/Dockerfile" ]; then
elif [ -a "${dir}/Dockerfile" ] || [ -a "${dir}/${default_variant}/Dockerfile" ]; then
versions+=("${dir#./}")
fi
done
Expand All @@ -182,7 +185,14 @@ function get_full_version() {
version=$1
shift

grep -m1 'ENV NODE_VERSION ' "${version}/Dockerfile" | cut -d' ' -f3
local default_dockerfile
if [ -f "${version}/${default_variant}/Dockerfile" ]; then
default_dockerfile="${version}/${default_variant}/Dockerfile"
else
default_dockerfile="${version}/Dockerfile"
fi

grep -m1 'ENV NODE_VERSION ' "${default_dockerfile}" | cut -d' ' -f3
}

function get_major_minor_version() {
Expand Down
25 changes: 17 additions & 8 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ array_chakracore_8='chakracore-8'
# shellcheck disable=SC2034
array_chakracore_10='chakracore-10 chakracore'

default_variant=$(get_config "./" "default_variant")

cd "$(cd "${0%/*}" && pwd -P)"

self="$(basename "${BASH_SOURCE[0]}")"
Expand Down Expand Up @@ -58,22 +60,25 @@ get_stub() {

for version in "${versions[@]}"; do
# Skip "docs" and other non-docker directories
[ -f "${version}/Dockerfile" ] || continue
[ -f "${version}/Dockerfile" ] || [ -f "${version}/${default_variant}/Dockerfile" ] || continue

stub=$(get_stub "${version}")
commit="$(fileCommit "${version}")"
fullVersion="$(get_tag "${version}" full)"
majorMinorVersion="$(get_tag "${version}" majorminor)"

IFS=' ' read -ra versionAliases <<<"$fullVersion $majorMinorVersion $stub"
# Get supported architectures for a specific version. See details in function.sh
IFS=' ' read -ra supportedArches <<<"$(get_supported_arches "${version}" "default")"

echo "Tags: $(join ', ' "${versionAliases[@]}")"
echo "Architectures: $(join ', ' "${supportedArches[@]}")"
echo "GitCommit: ${commit}"
echo "Directory: ${version}"
echo
if [ -f "${version}/Dockerfile" ]; then
# Get supported architectures for a specific version. See details in function.sh
IFS=' ' read -ra supportedArches <<<"$(get_supported_arches "${version}" "default")"

echo "Tags: $(join ', ' "${versionAliases[@]}")"
echo "Architectures: $(join ', ' "${supportedArches[@]}")"
echo "GitCommit: ${commit}"
echo "Directory: ${version}"
echo
fi

# Get supported variants according to the target architecture.
# See details in function.sh
Expand All @@ -87,6 +92,10 @@ for version in "${versions[@]}"; do
slash='/'
variantAliases=("${versionAliases[@]/%/-${variant//${slash}/-}}")
variantAliases=("${variantAliases[@]//latest-/}")
if [ "${variant}" = "${default_variant}" ]; then
variantAliases+=("${versionAliases[@]}")
fi

# Get supported architectures for a specific version and variant.
# See details in function.sh
IFS=' ' read -ra supportedArches <<<"$(get_supported_arches "${version}" "${variant}")"
Expand Down
16 changes: 10 additions & 6 deletions test-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ set -uo pipefail
IFS=',' read -ra versions_arg <<<"${1:-}"
IFS=',' read -ra variant_arg <<<"${2:-}"

default_variant=$(get_config "./" "default_variant")

function build() {
local version
local tag
Expand All @@ -28,6 +30,9 @@ function build() {
if [ -z "${variant}" ]; then
full_tag="${tag}"
path="${version}/${variant}"
elif [ "${variant}" = "default" ]; then
full_tag="${tag}"
path="${version}"
else
full_tag="${tag}-${variant}"
path="${version}/${variant}"
Expand All @@ -53,7 +58,7 @@ fi

for version in "${versions[@]}"; do
# Skip "docs" and other non-docker directories
[ -f "${version}/Dockerfile" ] || continue
[ -f "${version}/Dockerfile" ] || [ -a "${version}/${default_variant}/Dockerfile" ] || continue

tag=$(get_tag "${version}")
full_version=$(get_full_version "${version}")
Expand All @@ -62,15 +67,14 @@ for version in "${versions[@]}"; do
# See details in function.sh
IFS=' ' read -ra variants <<<"$(get_variants "$(dirname "${version}")" "${variant_arg[@]}")"

# Only build the default Dockerfile if "default" is in the variant list
if [[ "${variants[*]}" =~ "default" ]] || [[ "${variants[*]}" =~ "onbuild" ]]; then
build "${version}" "" "${tag}"
fi

for variant in "${variants[@]}"; do
# Skip non-docker directories
[ -f "${version}/${variant}/Dockerfile" ] || continue

if [ "${variant}" = "onbuild" ]; then
build "${version}" "${default_variant}" "$tag"
fi

build "${version}" "${variant}" "${tag}"
done

Expand Down
28 changes: 16 additions & 12 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,15 @@ function update_node_version() {
fromprefix="${arch}\\/"
fi

sed -Ei -e 's/^FROM (.*)/FROM '"${fromprefix}"'\1/' "${dockerfile}"
sed -Ei -e 's/^(ENV NODE_VERSION |FROM .*node:).*/\1'"${version}.${fullVersion:-0}"'/' "${dockerfile}"
nodeVersion="${version}.${fullVersion:-0}"

sed -Ei -e 's/^FROM (.*)/FROM '"$fromprefix"'\1/' "${dockerfile}"
sed -Ei -e 's/^(ENV NODE_VERSION ).*/\1'"${nodeVersion}"'/' "${dockerfile}"
sed -Ei -e 's/^(ENV YARN_VERSION ).*/\1'"${yarnVersion}"'/' "${dockerfile}"

# Only for onbuild variant
sed -Ei -e 's/^(FROM .*node:)[^-]*(-.*)/\1'"${nodeVersion}"'\2/' "${dockerfile}"

# shellcheck disable=SC1004
new_line=' \\\
'
Expand Down Expand Up @@ -104,25 +109,24 @@ echo '#### DO NOT MODIFY. THIS FILE IS AUTOGENERATED ####
' | cat - travis.yml.template >.travis.yml

for version in "${versions[@]}"; do
# Skip "docs" and other non-docker directories
[ -f "${version}/Dockerfile" ] || continue

parentpath=$(dirname "${version}")
versionnum=$(basename "${version}")
baseuri=$(get_config "${parentpath}" "baseuri")
update=$(in_versions_to_update "${version}")

add_stage "${baseuri}" "${version}" "default"

if [ "${update}" -eq 0 ]; then
info "Updating version ${version}..."
update_node_version "${baseuri}" "${versionnum}" "${parentpath}/Dockerfile.template" "${version}/Dockerfile" &
fi

# Get supported variants according the target architecture
# See details in function.sh
IFS=' ' read -ra variants <<<"$(get_variants "${parentpath}")"

if [ -f "${version}/Dockerfile" ]; then
add_stage "${baseuri}" "${version}" "default"

if [ "${update}" -eq 0 ]; then
info "Updating version ${version}..."
update_node_version "${baseuri}" "${versionnum}" "${parentpath}/Dockerfile.template" "${version}/Dockerfile" &
fi
fi

for variant in "${variants[@]}"; do
# Skip non-docker directories
[ -f "${version}/${variant}/Dockerfile" ] || continue
Expand Down