启动容器:
docker run --name u1804 -dit --hostname OK8 \
-v /sbin/busybox:/sbin/busybox -v /sbin/busybox:/sbin/netstat ubuntu:18.04
进入容器控制台:
docker exec -it u1804 bash
运行命令:
cd /tmp;
git clone https://github.com/alist-org/alist.git;\
git clone --recursive https://github.com/alist-org/alist-web.git;
#echo https://crowdin.com/project/alist/zh-CN;
cd /tmp;
wget https://crowdin.com/backend/download/project/alist/zh-CN.zip --no-check-certificate;\
unzip zh-CN.zip; #apt install -y nodejs ;
apt install -y npm;
npm install -g pnpm;
cd /tmp;
cp -r ./src/lang/zh-CN ./alist-web/src/lang/
cd alist-web;ls -al ./src/lang/;
node ./scripts/i18n.mjs;
#WARN engine pnpm@8.6.7: wanted: {"node":">=16.14"} (current: {"node":"8.10.0","npm":"3.5.2"})
#apt install -y nodejs ;
node版本不够高
通过nvm安装node v17.8.0:
export HOME=/root;
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
nvm --version
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
nvm --version
nvm ls-remote
nvm install v17.8.0
root@OK8:/tmp# nvm install v18.0.0
Downloading and installing node v18.0.0...
Downloading https://nodejs.org/dist/v18.0.0/node-v18.0.0-linux-x64.tar.xz...
############################################################################################################################################################################################################################# 100.0%
Computing checksum with sha256sum
Checksums matched!
node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run `nvm use --delete-prefix v18.0.0` to unset it.
root@OK8:/tmp#
root@OK8:/tmp/alist-web# npm install -g pnpm;
added 1 package, and audited 2 packages in 2s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
npm notice
npm notice New major version of npm available! 8.5.5 -> 9.8.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.8.0
npm notice Run npm install -g npm@9.8.0 to update!
npm notice
root@OK8:/tmp/alist-web#
继续:
pnpm install;
ls -al vite.config.*s ;
# vite.config.ts
#echo cat vite.config.*s ;
grep -r "chunkSizeWarningLimit" .
#./node_modules/.pnpm/vite@3.0.8_terser@5.14.2/node_modules/vite/dist/node/chunks/dep-74663fff.js: chunkSizeWarningLimit: 500,
sed -i "s/chunkSizeWarningLimit: 500/chunkSizeWarningLimit: 6500/g" ./node_modules/.pnpm/vite@3.0.8_terser@5.14.2/node_modules/vite/dist/node/chunks/dep-74663fff.js;
grep -r "chunkSizeWarningLimit" .
pnpm build;
#pnpm run build;
cd ../alist;
rm -rf ./public/dist/*;
cp -r ../alist-web/dist ./public/
export HOME=/root;
cd /tmp/alist;
go build -o main2 main.go;
/tmp/go/bin/go build -o main2 main.go;
./main2 admin;./main2 server;
从容器里复制出来:
docker cp u1804:/tmp/alist/main2 /tmp/alist2;
压缩一下:
upx -9 alist2 ;