mirror of
https://github.com/danog/code-server.git
synced 2024-11-26 20:34:56 +01:00
Stop bundling libraries in release
- Instead we now use CentOS 7 for the static build to guarantee that we only depend on libc v2.17 - For macOS we now pull in a static node binary and bundle that instead.
This commit is contained in:
parent
02a77b528b
commit
11d7932968
6
.github/workflows/ci.yaml
vendored
6
.github/workflows/ci.yaml
vendored
@ -55,7 +55,7 @@ jobs:
|
||||
name: npm-package
|
||||
path: ./release-npm-package
|
||||
- name: Run ./ci/steps/release-packages.sh
|
||||
uses: ./ci/container
|
||||
uses: ./ci/container/centos
|
||||
with:
|
||||
args: ./ci/steps/release-packages.sh
|
||||
- name: Upload release artifacts
|
||||
@ -75,7 +75,7 @@ jobs:
|
||||
name: npm-package
|
||||
path: ./release-npm-package
|
||||
- name: Run ./ci/steps/release-packages.sh
|
||||
uses: ./ci/container/arm64
|
||||
uses: ./ci/container/centos
|
||||
with:
|
||||
args: ./ci/steps/release-packages.sh
|
||||
- name: Upload release artifacts
|
||||
@ -94,8 +94,6 @@ jobs:
|
||||
with:
|
||||
name: npm-package
|
||||
path: ./release-npm-package
|
||||
- run: brew unlink node@12
|
||||
- run: brew install node
|
||||
- run: ./ci/steps/release-packages.sh
|
||||
env:
|
||||
# Otherwise we get rate limited when fetching the ripgrep binary.
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,3 +9,4 @@ release-packages/
|
||||
release-gcp/
|
||||
release-images/
|
||||
node_modules
|
||||
node-*
|
||||
|
@ -17,14 +17,6 @@ main() {
|
||||
mkdir -p "$RELEASE_PATH/bin"
|
||||
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"
|
||||
rsync "$node_path" "$RELEASE_PATH/lib/node"
|
||||
if [[ $OS == "linux" ]]; then
|
||||
bundle_dynamic_lib libstdc++
|
||||
bundle_dynamic_lib libgcc_s
|
||||
elif [[ $OS == "macos" ]]; then
|
||||
bundle_dynamic_lib libicui18n
|
||||
bundle_dynamic_lib libicuuc
|
||||
bundle_dynamic_lib libicudata
|
||||
fi
|
||||
|
||||
ln -s "./bin/code-server" "$RELEASE_PATH/code-server"
|
||||
ln -s "./lib/node" "$RELEASE_PATH/node"
|
||||
@ -33,17 +25,4 @@ main() {
|
||||
yarn --production --frozen-lockfile
|
||||
}
|
||||
|
||||
bundle_dynamic_lib() {
|
||||
local lib_name="$1"
|
||||
local lib_path
|
||||
|
||||
if [[ $OS == "linux" ]]; then
|
||||
lib_path="$(ldd "$RELEASE_PATH/lib/node" | grep "$lib_name" | awk '{print $3 }')"
|
||||
elif [[ $OS == "macos" ]]; then
|
||||
lib_path="$(otool -L "$RELEASE_PATH/lib/node" | grep "$lib_name" | awk '{print $1 }')"
|
||||
fi
|
||||
|
||||
cp "$lib_path" "$RELEASE_PATH/lib"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
@ -12,10 +12,10 @@ _realpath() {
|
||||
|
||||
# See https://github.com/cdr/code-server/issues/1537
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
# We read the symlink, which may be relative from $1.
|
||||
script="$1"
|
||||
if [ -L "$script" ]; then
|
||||
while [ -L "$script" ]; do
|
||||
# We recursively read the symlink, which may be relative from $script.
|
||||
script="$(readlink "$script")"
|
||||
cd "$(dirname "$script")"
|
||||
done
|
||||
@ -32,9 +32,4 @@ _realpath() {
|
||||
}
|
||||
|
||||
ROOT="$(dirname "$(dirname "$(_realpath "$0")")")"
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
export LD_LIBRARY_PATH="$ROOT/lib:${LD_LIBRARY_PATH-}"
|
||||
elif [ "$(uname)" = "Darwin" ]; then
|
||||
export DYLD_LIBRARY_PATH="$ROOT/lib:${DYLD_LIBRARY_PATH-}"
|
||||
fi
|
||||
exec "$ROOT/lib/node" "$ROOT" "$@"
|
||||
|
@ -15,7 +15,8 @@ main() {
|
||||
./release-standalone/bin/code-server --extensions-dir "$EXTENSIONS_DIR" --install-extension ms-python.python
|
||||
local installed_extensions
|
||||
installed_extensions="$(./release-standalone/bin/code-server --extensions-dir "$EXTENSIONS_DIR" --list-extensions 2>&1)"
|
||||
if [[ $installed_extensions != "ms-python.python" ]]; then
|
||||
if [[ "$installed_extensions" != "info Using config file ~/.config/code-server/config.yaml
|
||||
ms-python.python" ]]; then
|
||||
echo "Unexpected output from listing extensions:"
|
||||
echo "$installed_extensions"
|
||||
exit 1
|
||||
|
@ -43,7 +43,7 @@ RUN ARCH="$(dpkg --print-architecture)" && \
|
||||
# rm -R shellcheck*
|
||||
|
||||
# Install Go dependencies
|
||||
RUN ARCH="$(dpkg --print-architecture)" && \
|
||||
RUN ARCH="$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')" && \
|
||||
curl -fsSL "https://dl.google.com/go/go1.14.3.linux-$ARCH.tar.gz" | tar -C /usr/local -xz
|
||||
ENV PATH=/usr/local/go/bin:/root/go/bin:$PATH
|
||||
ENV GO111MODULE=on
|
||||
|
@ -1,53 +0,0 @@
|
||||
FROM debian:9
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
# Needed for debian repositories added below.
|
||||
RUN apt-get install -y curl gnupg
|
||||
|
||||
# Installs node.
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - && \
|
||||
apt-get install -y nodejs
|
||||
|
||||
# Installs yarn.
|
||||
RUN curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
|
||||
apt-get update && apt-get install -y yarn
|
||||
|
||||
# Installs VS Code build deps.
|
||||
RUN apt-get install -y build-essential \
|
||||
libsecret-1-dev \
|
||||
libx11-dev \
|
||||
libxkbfile-dev
|
||||
|
||||
# Installs envsubst.
|
||||
RUN apt-get install -y gettext-base
|
||||
|
||||
# Misc build dependencies.
|
||||
RUN apt-get install -y git rsync unzip
|
||||
|
||||
# We need latest jq from debian buster for date support.
|
||||
RUN ARCH="$(dpkg --print-architecture)" && \
|
||||
curl -fsSOL http://http.us.debian.org/debian/pool/main/libo/libonig/libonig5_6.9.1-1_$ARCH.deb && \
|
||||
dpkg -i libonig*.deb && \
|
||||
curl -fsSOL http://http.us.debian.org/debian/pool/main/j/jq/libjq1_1.5+dfsg-2+b1_$ARCH.deb && \
|
||||
dpkg -i libjq*.deb && \
|
||||
curl -fsSOL http://http.us.debian.org/debian/pool/main/j/jq/jq_1.5+dfsg-2+b1_$ARCH.deb && \
|
||||
dpkg -i jq*.deb && rm *.deb
|
||||
|
||||
# Installs shellcheck.
|
||||
# Unfortunately coredumps on debian:8 so disabled for now.
|
||||
#RUN curl -fsSL https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.$(uname -m).tar.xz | \
|
||||
# tar -xJ && \
|
||||
# mv shellcheck*/shellcheck /usr/local/bin && \
|
||||
# rm -R shellcheck*
|
||||
|
||||
# Install Go dependencies
|
||||
RUN ARCH="$(dpkg --print-architecture)" && \
|
||||
curl -fsSL "https://dl.google.com/go/go1.14.3.linux-$ARCH.tar.gz" | tar -C /usr/local -xz
|
||||
ENV PATH=/usr/local/go/bin:/root/go/bin:$PATH
|
||||
ENV GO111MODULE=on
|
||||
RUN go get mvdan.cc/sh/v3/cmd/shfmt
|
||||
RUN go get github.com/goreleaser/nfpm/cmd/nfpm
|
||||
|
||||
RUN curl -fsSL https://get.docker.com | sh
|
@ -1,6 +0,0 @@
|
||||
# arm64
|
||||
|
||||
Unfortunately there is no arm64 build of `debian:8` so
|
||||
we need to use `debian:9` instead.
|
||||
|
||||
This is just an exact copy of [../Dockerfile](../Dockerfile) with the base image change.
|
22
ci/container/centos/Dockerfile
Normal file
22
ci/container/centos/Dockerfile
Normal file
@ -0,0 +1,22 @@
|
||||
FROM centos:7
|
||||
|
||||
RUN curl -sL https://rpm.nodesource.com/setup_14.x | bash - && \
|
||||
yum install -y nodejs &&
|
||||
npm install -g yarn
|
||||
|
||||
RUN yum groupinstall -y 'Development Tools'
|
||||
RUN yum install -y python2 libsecret-devel libX11-devel libxkbfile-devel
|
||||
|
||||
RUN npm config set python python2
|
||||
|
||||
RUN yum install -y epel-release && yum install -y jq
|
||||
RUN yum install -y rsync
|
||||
|
||||
# Copied from ../Dockerfile
|
||||
# Install Go dependencies
|
||||
RUN ARCH="$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/')" && \
|
||||
curl -fsSL "https://dl.google.com/go/go1.14.3.linux-$ARCH.tar.gz" | tar -C /usr/local -xz
|
||||
ENV PATH=/usr/local/go/bin:/root/go/bin:$PATH
|
||||
ENV GO111MODULE=on
|
||||
RUN go get mvdan.cc/sh/v3/cmd/shfmt
|
||||
RUN go get github.com/goreleaser/nfpm/cmd/nfpm
|
@ -4,6 +4,11 @@ set -euo pipefail
|
||||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
if [[ "$OSTYPE" == darwin* ]]; then
|
||||
curl -L https://nodejs.org/dist/v14.4.0/node-v14.4.0-darwin-x64.tar.gz | tar -xz
|
||||
PATH="$PATH:node-v14.4.0-darwin-x64/bin"
|
||||
fi
|
||||
|
||||
# https://github.com/actions/upload-artifact/issues/38
|
||||
tar -xzf release-npm-package/package.tar.gz
|
||||
|
||||
|
@ -20,7 +20,7 @@ sudo apt-get install -y \
|
||||
|
||||
```bash
|
||||
sudo yum groupinstall -y 'Development Tools'
|
||||
sudo yum config-manager --set-enabled PowerTools
|
||||
sudo yum config-manager --set-enabled PowerTools # unnecessary on CentOS 7
|
||||
sudo yum install -y python2 libsecret-devel libX11-devel libxkbfile-devel
|
||||
npm config set python python2
|
||||
```
|
||||
|
@ -122,25 +122,7 @@ const main = async (args: Args, cliArgs: Args, configArgs: Args): Promise<void>
|
||||
}
|
||||
}
|
||||
|
||||
function trimLDLibraryPath(): void {
|
||||
let ldVar: string
|
||||
if (process.platform === "linux") {
|
||||
ldVar = "LD_LIBRARY_PATH"
|
||||
} else if (process.platform === "darwin") {
|
||||
ldVar = "DYLD_LIBRARY_PATH"
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
||||
// Removes the leading path added by ./ci/build/code-server.sh to use our bundled
|
||||
// dynamic libraries. See ci/build/build-standalone-release.sh
|
||||
// This is required to avoid child processes using our bundled libraries.
|
||||
process.env[ldVar] = process.env[ldVar]?.replace(path.dirname(process.execPath) + ":", "")
|
||||
}
|
||||
|
||||
async function entry(): Promise<void> {
|
||||
trimLDLibraryPath()
|
||||
|
||||
const tryParse = async (): Promise<[Args, Args, Args]> => {
|
||||
try {
|
||||
const cliArgs = parse(process.argv.slice(2))
|
||||
|
Loading…
Reference in New Issue
Block a user