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 16, 2019
1 parent 40d5384 commit 22d1745
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 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.16.3

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="1ec908d4a8e2d9fab1cc2f792a50862cc220e85944be11599221228e822e2549" \
;; \
*) ;; \
esac \
&& if [ -n "${CHECKSUM}" ]; then \
Expand Down
6 changes: 4 additions & 2 deletions 12/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,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="e5eb5855be2f74f41b1d86f7dbb5483c3ec9ecd935934aa4bb4f88b2f7e81d51" \
;; \
*) ;; \
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 22d1745

Please sign in to comment.