Skip to content

Commit

Permalink
Fetch the checksum for the pre-built alpine binary at image update time.
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentGoderre committed Oct 24, 2019
1 parent f574b2a commit c6b44fb
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 20 deletions.
8 changes: 4 additions & 4 deletions 10/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM alpine:3.9

ARG CHECKSUM=

ENV NODE_VERSION 10.17.0

RUN addgroup -g 1000 node \
Expand All @@ -12,8 +10,10 @@ RUN addgroup -g 1000 node \
curl \
&& ARCH= && alpineArch="$(arch)" \
&& case "${alpineArch##*-}" in \
x86_64) ARCH='x64';; \
i386) ARCH='x86';; \
x86_64) \
ARCH='x64' \
CHECKSUM="f893a03c5b51e0c540e32cd52773221a2f9b6d575e7fe79ffe9e878483c703ff" \
;; \
*) ;; \
esac \
&& if [ -n "${CHECKSUM}" ]; then \
Expand Down
8 changes: 4 additions & 4 deletions 12/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM alpine:3.9

ARG CHECKSUM=

ENV NODE_VERSION 12.13.0

RUN addgroup -g 1000 node \
Expand All @@ -12,8 +10,10 @@ RUN addgroup -g 1000 node \
curl \
&& ARCH= && alpineArch="$(arch)" \
&& case "${alpineArch##*-}" in \
x86_64) ARCH='x64';; \
i386) ARCH='x86';; \
x86_64) \
ARCH='x64' \
CHECKSUM="f1c73636c4d345c4aefd65cc959f793d7bb795200d43e19e418d7811670b03dd" \
;; \
*) ;; \
esac \
&& if [ -n "${CHECKSUM}" ]; then \
Expand Down
8 changes: 4 additions & 4 deletions 13/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM alpine:3.10

ARG CHECKSUM=

ENV NODE_VERSION 13.0.1

RUN addgroup -g 1000 node \
Expand All @@ -12,8 +10,10 @@ RUN addgroup -g 1000 node \
curl \
&& ARCH= && alpineArch="$(arch)" \
&& case "${alpineArch##*-}" in \
x86_64) ARCH='x64';; \
i386) ARCH='x86';; \
x86_64) \
ARCH='x64' \
CHECKSUM="5f40392e14e81a566c06f4abcbe735575f2d7045709211eb7245ef8f67896bee" \
;; \
*) ;; \
esac \
&& if [ -n "${CHECKSUM}" ]; then \
Expand Down
8 changes: 4 additions & 4 deletions 8/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM alpine:3.9

ARG CHECKSUM=

ENV NODE_VERSION 8.16.2

RUN addgroup -g 1000 node \
Expand All @@ -12,8 +10,10 @@ RUN addgroup -g 1000 node \
curl \
&& ARCH= && alpineArch="$(arch)" \
&& case "${alpineArch##*-}" in \
x86_64) ARCH='x64';; \
i386) ARCH='x86';; \
x86_64) \
ARCH='x64' \
CHECKSUM="39276723f03e4adaa9f2eeded8653ca6b74d3df23ac70a3455a28c51f0cf0001" \
;; \
*) ;; \
esac \
&& if [ -n "${CHECKSUM}" ]; then \
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile-alpine.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM alpine:0.0

ARG CHECKSUM=

ENV NODE_VERSION 0.0.0

RUN addgroup -g 1000 node \
Expand All @@ -12,8 +10,10 @@ RUN addgroup -g 1000 node \
curl \
&& ARCH= && alpineArch="$(arch)" \
&& case "${alpineArch##*-}" in \
x86_64) ARCH='x64';; \
i386) ARCH='x86';; \
x86_64) \
ARCH='x64' \
CHECKSUM=CHECKSUM_x64 \
;; \
*) ;; \
esac \
&& if [ -n "${CHECKSUM}" ]; then \
Expand Down
6 changes: 6 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,14 @@ function update_node_version() {
if [ "${SKIP}" = true ]; then
# Get the currently used Alpine version
alpine_version=$(grep "FROM" "${dockerfile}" | cut -d':' -f2)
checksum=$(grep -o "CHECKSUM=\".*\"" "${dockerfile}" | cut -d'=' -f2)
else
checksum="\"$(
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
)\""
fi
sed -Ei -e "s/(alpine:)0.0/\\1${alpine_version}/" "${dockerfile}-tmp"
sed -Ei -e "s/CHECKSUM=CHECKSUM_x64/CHECKSUM=${checksum}/" "${dockerfile}-tmp"
elif is_debian "${variant}"; then
sed -Ei -e "s/(buildpack-deps:)name/\\1${variant}/" "${dockerfile}-tmp"
elif is_debian_slim "${variant}"; then
Expand Down

0 comments on commit c6b44fb

Please sign in to comment.