Skip to content

Commit

Permalink
Add difft to container for better git diff UI
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Dec 31, 2024
1 parent 75767be commit a424f40
Showing 1 changed file with 27 additions and 18 deletions.
45 changes: 27 additions & 18 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,42 @@ RUN apt-get update \

RUN <<EOF
if [ "$TARGETARCH" = "amd64" ]; then
export NODE_CHECKSUM=$NODE_CHECKSUM_X64;
export PNPM_CHECKSUM=$PNPM_CHECKSUM_X64;
export ARCH="x64";
export NODE_CHECKSUM=$NODE_CHECKSUM_X64
export PNPM_CHECKSUM=$PNPM_CHECKSUM_X64
export DIFFT_URL=https://github.com/Wilfred/difftastic/releases/download/0.62.0/difft-x86_64-unknown-linux-gnu.tar.gz
export DIFFT_CHECKSUM=bf546299085abd497dce115739bc00370d0c0386030e43f14fe137ef3a5f773b
export ARCH="x64"
elif [ "$TARGETARCH" = "arm64" ]; then
export NODE_CHECKSUM=$NODE_CHECKSUM_ARM64;
export PNPM_CHECKSUM=$PNPM_CHECKSUM_ARM64;
export ARCH="arm64";
export NODE_CHECKSUM=$NODE_CHECKSUM_ARM64
export PNPM_CHECKSUM=$PNPM_CHECKSUM_ARM64
export DIFFT_URL=https://github.com/Wilfred/difftastic/releases/download/0.62.0/difft-aarch64-unknown-linux-gnu.tar.gz
export DIFFT_CHECKSUM=3b5e935561dfc9656309c29f0a2aa57cf96592f76c03da52db166d3a73e161e2
export ARCH="arm64"
else
echo "Unsupported architecture: $TARGETARCH";
exit 1;
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;
--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
--fail --show-error --location --silent --output /usr/local/bin/pnpm
echo "$PNPM_CHECKSUM /usr/local/bin/pnpm" | sha256sum -c

curl "${DIFFT_URL}" \
--fail --show-error --location --silent --output /difft.tar.gz
echo "$DIFFT_CHECKSUM /difft.tar.gz" | sha256sum -c

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'
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'
tar -xz -f /difft.tar.gz -C /usr/local/bin --remove-files

RUN chmod a+rx /usr/local/bin/pnpm
chmod a+rx /usr/local/bin/pnpm
EOF

RUN userdel -r ubuntu && useradd -m -s /bin/zsh developer
USER developer
Expand Down

0 comments on commit a424f40

Please sign in to comment.