Closed 3timeslazy closed 4 weeks ago
curl -fsSL https://get.pnpm.io/install.sh
Running unknown script is very unsafe. Also, it will break checksum check.
Seems like we need to add ARM CPU check to Dockerfile.
What do you think about this approach?
# Creates development machine inside docker
# so every developer will have the same environment
FROM docker.io/ubuntu:24.04
ARG TARGETARCH
ENV NODE_VERSION 22.6.0
ENV PNPM_VERSION 9.6.0
ENV NODE_CHECKSUM_arm64 1816e42d4848aa1484910373a1f2f68f43fd6f96a4ef478a9553d05ffa3f8fb2
ENV PNPM_CHECKSUM_arm64 7e5da837e616a613cf257da034d611553c9fdcae54ffa9e1328be0fbcabeb63e
ENV NODE_CHECKSUM_x64 f2f4ccbcbc0a443e5fadebd1149a22f96087ec09cef52ff343a15ee835206d96
ENV PNPM_CHECKSUM_x64 efdfcefb089b01dafa98c4c3fa47f544046d0e4de67055a69b0563875de83175
RUN apt-get update \
&& apt-get install -y eza zsh git tig ripgrep bat curl tar micro psmisc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN <<EOF
if [ "$TARGETARCH" = "amd64" ]; then
export NODE_CHECKSUM=${NODE_CHECKSUM_x64};
export PNPM_CHECKSUM=${PNPM_CHECKSUM_x64};
export ARCH="x64"
elif [ "$TARGETARCH" = "arm64" ]; then
export NODE_CHECKSUM=$NODE_CHECKSUM_arm64;
export PNPM_CHECKSUM=$PNPM_CHECKSUM_arm64;
export ARCH="arm64"
else
echo "Unsupported architecture: $TARGETARCH";
exit 1;
fi
curl "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${ARCH}.tar.gz" \
--fail --show-error --location --silent --output /node.tar.gz;
echo "$NODE_CHECKSUM /node.tar.gz" | sha256sum -c;
curl "https://github.com/pnpm/pnpm/releases/download/v${PNPM_VERSION}/pnpm-linux-${ARCH}" \
--fail --show-error --location --silent --output /usr/local/bin/pnpm;
echo "$PNPM_CHECKSUM /usr/local/bin/pnpm" | sha256sum -c;
EOF
RUN tar -xz -f /node.tar.gz -C /usr/local --remove-files --strip-components=1 \
--exclude='*.md' --exclude='LICENSE' \
--exclude='share' --exclude='lib/node_modules/' \
--exclude='bin/npm' --exclude='bin/npx' --exclude='bin/corepack'
RUN chmod a+rx /usr/local/bin/pnpm
RUN userdel -r ubuntu && useradd -m -s /bin/zsh developer
USER developer
RUN pnpm config set store-dir /home/developer/.local/share/pnpm/store \
&& pnpm config set ignore-scripts false
RUN echo 'PS1="%d$ "' > ~/.zshrc
Looks good, send PR. But can you also update https://github.com/hplush/slowreader/blob/main/scripts/update-env.ts
Hi everyone,
First of all, thank you for the awesome project!
Description
I recently ran into a problem running devcontainer on a new MacBook with an M chip. I ran devcontainer using OrbStack and VS Code DevContainer extension and got this error:
I think the problem is on this line:
That command downloads the same binary regardless of the CPU architecture. When I locally changed that to
pnpm-linux-arm64
it worked.Possible solution
I believe the problem can be solved with the official pnpm install script: https://get.pnpm.io/install.sh. If you look at it, you'll see that it checks the CPU architecture and downloads the corresponding binary.
I tried it locally and replaced the line above with these three lines and it worked: