feat: add yarn

This commit is contained in:
Jakub Panek 2024-09-02 11:52:20 +02:00
parent 0c30febc9a
commit 4140f81c76
No known key found for this signature in database
GPG key ID: D5E8A1F82F3BDA9D
2 changed files with 48 additions and 0 deletions

View file

@ -0,0 +1,39 @@
FROM scratch AS base
ENV VERSION=1.22.22
ENV SRC_HASH=88268464199d1611fcf73ce9c0a6c4d44c7d5363682720d8506f6508addf36a0
ENV SRC_FILE=yarn-v${VERSION}.tar.gz
ENV SRC_SITE=https://yarnpkg.com/downloads/${VERSION}/${SRC_FILE}
FROM base AS fetch
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
FROM fetch AS build
COPY --from=stagex/musl . /
COPY --from=stagex/busybox . /
RUN tar -xf ${SRC_FILE}
WORKDIR /yarn-v${VERSION}
FROM build AS install
ENV DESTDIR=/rootfs
RUN --network=none <<-EOF
destdir="usr/share/node_modules/yarn"
mkdir -p $DESTDIR/$destdir
cp -R ./* $DESTDIR/$destdir
# Windows files
rm $DESTDIR/$destdir/bin/*.cmd
# Shell shim
rm $DESTDIR/$destdir/bin/yarn
# Old alias
rm $DESTDIR/$destdir/bin/yarnpkg
mkdir -p $DESTDIR/usr/bin
ln -s ../share/node_modules/yarn/bin/yarn.js $DESTDIR/usr/bin/yarn
ln -s ../share/node_modules/yarn/bin/yarn.js $DESTDIR/usr/bin/yarnpkg
sed -i 's/\"tar\"/\"stagex\"/g' $DESTDIR/$destdir/package.json
EOF
FROM stagex/filesystem AS package
COPY --from=install /rootfs/. /

View file

@ -4338,6 +4338,15 @@ out/xz/index.json: \
out/po4a/index.json
$(call build,xz)
.PHONY: yarn
yarn: out/yarn/index.json
out/yarn/index.json: \
packages/yarn/Containerfile \
out/busybox/index.json \
out/filesystem/index.json \
out/musl/index.json
$(call build,yarn)
.PHONY: yq
yq: out/yq/index.json
out/yq/index.json: \