Add fatrw to docker image

This commit is contained in:
Felipe Lalanne 2022-06-15 16:11:23 -04:00
parent dc8b75485c
commit e3bb7f653e

View File

@ -1,13 +1,17 @@
ARG ARCH=%%BALENA_ARCH%% ARG ARCH=%%BALENA_ARCH%%
ARG NODE_VERSION=12.16.2 ARG NODE_VERSION=12.16.2
ARG FATRW_VERSION=0.1.5
FROM balenalib/$ARCH-alpine-supervisor-base:3.11 as BUILD FROM balenalib/$ARCH-alpine-supervisor-base:3.11 as BUILD
ARG ARCH ARG ARCH
ARG NODE_VERSION ARG NODE_VERSION
ARG FATRW_VERSION
ARG NODE_ARCHIVE="node-no-intl-v${NODE_VERSION}-linux-alpine-${ARCH}.tar.gz" ARG NODE_ARCHIVE="node-no-intl-v${NODE_VERSION}-linux-alpine-${ARCH}.tar.gz"
ARG S3_BASE="https://resin-packages.s3.amazonaws.com" ARG S3_BASE="https://resin-packages.s3.amazonaws.com"
ARG NODE_LOCATION="${S3_BASE}/node/v${NODE_VERSION}/${NODE_ARCHIVE}" ARG NODE_LOCATION="${S3_BASE}/node/v${NODE_VERSION}/${NODE_ARCHIVE}"
ARG FATRW_ARCHIVE="fatrw-${ARCH}.tar.gz"
ARG FATRW_LOCATION="https://github.com/balena-os/fatrw/releases/download/v${FATRW_VERSION}/${FATRW_ARCHIVE}"
# DO NOT REMOVE THE cross-build-* COMMANDS # DO NOT REMOVE THE cross-build-* COMMANDS
# The following commands are absolutely needed. When we # The following commands are absolutely needed. When we
@ -28,15 +32,14 @@ RUN apk add --no-cache \
python \ python \
curl \ curl \
binutils \ binutils \
libgcc \ libgcc \
libstdc++ \ libstdc++ \
libuv \ libuv \
sqlite-libs \ sqlite-libs \
sqlite-dev \ sqlite-dev \
dmidecode \ dmidecode \
dbus-dev \ dbus-dev \
procmail procmail # procmail is installed for the lockfile binary
# procmail is installed for the lockfile binary
COPY build-utils/node-sums.txt . COPY build-utils/node-sums.txt .
@ -47,6 +50,15 @@ RUN curl -SLO "${NODE_LOCATION}" \
&& rm -f "${NODE_ARCHIVE}" \ && rm -f "${NODE_ARCHIVE}" \
&& strip /usr/local/bin/node && strip /usr/local/bin/node
# Install fatrw
# TODO: add checksum
RUN curl -SLO "${FATRW_LOCATION}" && \
echo curl -SLO "${FATRW_LOCATION}" && \
ls -la "${FATRW_ARCHIVE}" && \
tar -xzf "${FATRW_ARCHIVE}" -C /usr/local/bin && \
rm -f "${FATRW_ARCHIVE}" && \
strip /usr/local/bin/fatrw
COPY package*.json ./ COPY package*.json ./
RUN npm ci --build-from-source --sqlite=/usr/lib RUN npm ci --build-from-source --sqlite=/usr/lib
@ -108,6 +120,7 @@ RUN apk add --no-cache \
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY --from=BUILD /usr/local/bin/node /usr/local/bin/node COPY --from=BUILD /usr/local/bin/node /usr/local/bin/node
COPY --from=BUILD /usr/local/bin/fatrw /usr/local/bin/fatrw
COPY --from=BUILD /usr/bin/lockfile /usr/bin/lockfile COPY --from=BUILD /usr/bin/lockfile /usr/bin/lockfile
COPY --from=BUILD /usr/src/app/dist ./dist COPY --from=BUILD /usr/src/app/dist ./dist
COPY --from=BUILD /usr/src/app/package.json ./ COPY --from=BUILD /usr/src/app/package.json ./