Skip to content

Commit 537bc56

Browse files
committed
Updated update.sh to allow skiping everything besides windows
1 parent 47843c9 commit 537bc56

File tree

1 file changed

+28
-17
lines changed

1 file changed

+28
-17
lines changed

update.sh

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ if [ "${SKIP}" != true ]; then
7777
yarnVersion="$(curl -sSL --compressed https://yarnpkg.com/latest-version)"
7878
fi
7979

80+
if [ "${WINDOWS_ONLY}" = true ]; then
81+
echo "Updating Windows images only..."
82+
fi
83+
8084
function in_versions_to_update() {
8185
local version=$1
8286

@@ -129,6 +133,10 @@ function update_node_version() {
129133
shift
130134
fi
131135

136+
if [ "${WINDOWS_ONLY}" = true ] && ! is_windows "${variant}"; then
137+
return
138+
fi
139+
132140
fullVersion="$(curl -sSL --compressed "${baseuri}" | grep '<a href="v'"${version}." | sed -E 's!.*<a href="v([^"/]+)/?".*!\1!' | cut -d'.' -f2,3 | sort -V | tail -1)"
133141
(
134142
cp "${template}" "${dockerfile}-tmp"
@@ -155,7 +163,7 @@ function update_node_version() {
155163
while read -r line; do
156164
pattern='"\$\{'$(echo "${key_type}" | tr '[:lower:]' '[:upper:]')'_KEYS\[@\]\}"'
157165
if is_windows "${variant}"; then
158-
if [ "$line" = "$last_line" ]; then # Check if it's the last key
166+
if [ "$line" = "$last_line" ]; then # Check if it's the last key
159167
sed -Ei -e "s/([ \\t]*)(${pattern})/\\1'${line}'${new_line}\\1\\2/" "${dockerfile}-tmp"
160168
else
161169
sed -Ei -e "s/([ \\t]*)(${pattern})/\\1'${line}',${new_line}\\1\\2/" "${dockerfile}-tmp"
@@ -167,23 +175,26 @@ function update_node_version() {
167175
sed -Ei -e "/${pattern}/d" "${dockerfile}-tmp"
168176
done
169177

170-
if is_alpine "${variant}"; then
171-
alpine_version="${variant#*alpine}"
172-
checksum=$(
173-
curl -sSL --compressed "https://unofficial-builds.nodejs.org/download/release/v${nodeVersion}/SHASUMS256.txt" | grep "node-v${nodeVersion}-linux-x64-musl.tar.xz" | cut -d' ' -f1
174-
)
175-
if [ -z "$checksum" ]; then
176-
rm -f "${dockerfile}-tmp"
177-
fatal "Failed to fetch checksum for version ${nodeVersion}"
178+
if [ "${WINDOWS_ONLY}" = false ]; then
179+
if is_alpine "${variant}"; then
180+
alpine_version="${variant#*alpine}"
181+
checksum=$(
182+
curl -sSL --compressed "https://unofficial-builds.nodejs.org/download/release/v${nodeVersion}/SHASUMS256.txt" | grep "node-v${nodeVersion}-linux-x64-musl.tar.xz" | cut -d' ' -f1
183+
)
184+
if [ -z "$checksum" ]; then
185+
rm -f "${dockerfile}-tmp"
186+
fatal "Failed to fetch checksum for version ${nodeVersion}"
187+
fi
188+
sed -Ei -e "s/(alpine:)0.0/\\1${alpine_version}/" "${dockerfile}-tmp"
189+
sed -Ei -e "s/CHECKSUM=CHECKSUM_x64/CHECKSUM=\"${checksum}\"/" "${dockerfile}-tmp"
190+
elif is_debian "${variant}"; then
191+
sed -Ei -e "s/(buildpack-deps:)name/\\1${variant}/" "${dockerfile}-tmp"
192+
elif is_debian_slim "${variant}"; then
193+
sed -Ei -e "s/(debian:)name-slim/\\1${variant}/" "${dockerfile}-tmp"
178194
fi
179-
sed -Ei -e "s/(alpine:)0.0/\\1${alpine_version}/" "${dockerfile}-tmp"
180-
sed -Ei -e "s/CHECKSUM=CHECKSUM_x64/CHECKSUM=\"${checksum}\"/" "${dockerfile}-tmp"
195+
fi
181196

182-
elif is_debian "${variant}"; then
183-
sed -Ei -e "s/(buildpack-deps:)name/\\1${variant}/" "${dockerfile}-tmp"
184-
elif is_debian_slim "${variant}"; then
185-
sed -Ei -e "s/(debian:)name-slim/\\1${variant}/" "${dockerfile}-tmp"
186-
elif is_windows "${variant}"; then
197+
if is_windows "${variant}"; then
187198
windows_version="${variant#*windows-}"
188199
checksum=$(
189200
curl -sSL --compressed "https://nodejs.org/dist/v${nodeVersion}/SHASUMS256.txt" | grep "node-v${nodeVersion}-win-x64.zip" | cut -d' ' -f1
@@ -254,7 +265,7 @@ for version in "${versions[@]}"; do
254265
elif is_windows "${variant}"; then
255266
template_file="${parentpath}/Dockerfile-windows.template"
256267
fi
257-
268+
258269
# Copy .sh only if not is_windows
259270
if ! is_windows "${variant}"; then
260271
cp "${parentpath}/docker-entrypoint.sh" "${version}/${variant}/docker-entrypoint.sh"

0 commit comments

Comments
 (0)