Fix centos image for arm64
This commit is contained in:
parent
cc139acfd1
commit
308a84e6ec
@ -1,29 +1,23 @@
|
||||
FROM centos:7
|
||||
|
||||
RUN yum update -y \
|
||||
&& yum install -y epel-release centos-release-scl \
|
||||
&& yum-config-manager --enable rhel-server-rhscl-7-rpms \
|
||||
&& yum update -y \
|
||||
&& yum install -y \
|
||||
devtoolset-6 \
|
||||
gcc-c++ \
|
||||
xz \
|
||||
ccache \
|
||||
git \
|
||||
wget \
|
||||
openssl \
|
||||
libxkbfile-devel \
|
||||
libsecret-devel \
|
||||
libx11-devel
|
||||
RUN yum update -y && yum install -y \
|
||||
devtoolset-6 \
|
||||
gcc-c++ \
|
||||
xz \
|
||||
ccache \
|
||||
git \
|
||||
wget \
|
||||
openssl \
|
||||
libxkbfile-devel \
|
||||
libsecret-devel \
|
||||
libx11-devel
|
||||
|
||||
RUN mkdir /usr/share/node && cd /usr/share/node \
|
||||
&& curl https://nodejs.org/dist/v12.14.0/node-v12.14.0-linux-x64.tar.xz | tar xJ --strip-components=1 --
|
||||
&& curl "https://nodejs.org/dist/v12.14.0/node-v12.14.0-linux-$(uname -m | sed 's/86_//; s/aarch/arm/').tar.xz" | tar xJ --strip-components=1 --
|
||||
ENV PATH "$PATH:/usr/share/node/bin"
|
||||
RUN npm install -g yarn
|
||||
|
||||
RUN curl -L https://github.com/mvdan/sh/releases/download/v3.0.1/shfmt_v3.0.1_linux_amd64 > /usr/local/bin/shfmt \
|
||||
RUN curl -L "https://github.com/mvdan/sh/releases/download/v3.0.1/shfmt_v3.0.1_linux_$(uname -m | sed 's/x86_/amd/; s/aarch64/arm/')" > /usr/local/bin/shfmt \
|
||||
&& chmod +x /usr/local/bin/shfmt
|
||||
|
||||
RUN echo 'source /opt/rh/devtoolset-6/enable' >> /root/.bashrc
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "-c"]
|
||||
|
@ -194,8 +194,8 @@ export class UpdateHttpProvider extends HttpProvider {
|
||||
}
|
||||
}
|
||||
|
||||
public async downloadAndApplyUpdate(update: Update, targetPath?: string, target?: string): Promise<void> {
|
||||
const releaseName = await this.getReleaseName(update, target)
|
||||
public async downloadAndApplyUpdate(update: Update, targetPath?: string): Promise<void> {
|
||||
const releaseName = await this.getReleaseName(update)
|
||||
const url = this.downloadUrl.replace("{{VERSION}}", update.version).replace("{{RELEASE_NAME}}", releaseName)
|
||||
|
||||
let downloadPath = path.join(tmpdir, "updates", releaseName)
|
||||
@ -298,7 +298,8 @@ export class UpdateHttpProvider extends HttpProvider {
|
||||
/**
|
||||
* Given an update return the name for the packaged archived.
|
||||
*/
|
||||
private async getReleaseName(update: Update, target: string = os.platform()): Promise<string> {
|
||||
public async getReleaseName(update: Update): Promise<string> {
|
||||
let target: string = os.platform()
|
||||
if (target === "linux") {
|
||||
const result = await util
|
||||
.promisify(cp.exec)("ldd --version")
|
||||
|
@ -2,6 +2,7 @@ import zip from "adm-zip"
|
||||
import * as assert from "assert"
|
||||
import * as fs from "fs-extra"
|
||||
import * as http from "http"
|
||||
import * as os from "os"
|
||||
import * as path from "path"
|
||||
import * as tar from "tar-fs"
|
||||
import * as zlib from "zlib"
|
||||
@ -65,7 +66,20 @@ describe("update", () => {
|
||||
}
|
||||
|
||||
before(async () => {
|
||||
const archiveName = "code-server-9999999.99999.9999-linux-x86_64"
|
||||
await new Promise((resolve, reject) => {
|
||||
server.on("error", reject)
|
||||
server.on("listening", resolve)
|
||||
server.listen({
|
||||
port: 0,
|
||||
host: "localhost",
|
||||
})
|
||||
})
|
||||
|
||||
const p = provider()
|
||||
const archiveName = (await p.getReleaseName({ version: "9999999.99999.9999", checked: 0 })).replace(
|
||||
/.tar.gz$|.zip$/,
|
||||
"",
|
||||
)
|
||||
await fs.remove(path.join(tmpdir, "tests/updates"))
|
||||
await fs.mkdirp(path.join(archivePath, archiveName))
|
||||
|
||||
@ -74,8 +88,16 @@ describe("update", () => {
|
||||
fs.writeFile(path.join(archivePath, archiveName, "node"), `NODE BINARY`),
|
||||
])
|
||||
|
||||
await Promise.all([
|
||||
new Promise((resolve, reject) => {
|
||||
if (os.platform() === "darwin") {
|
||||
await new Promise((resolve, reject) => {
|
||||
const zipFile = new zip()
|
||||
zipFile.addLocalFolder(archivePath)
|
||||
zipFile.writeZip(archivePath + ".zip", (error) => {
|
||||
return error ? reject(error) : resolve(error)
|
||||
})
|
||||
})
|
||||
} else {
|
||||
await new Promise((resolve, reject) => {
|
||||
const write = fs.createWriteStream(archivePath + ".tar.gz")
|
||||
const compress = zlib.createGzip()
|
||||
compress.pipe(write)
|
||||
@ -86,24 +108,8 @@ describe("update", () => {
|
||||
write.on("finish", () => {
|
||||
resolve()
|
||||
})
|
||||
}),
|
||||
new Promise((resolve, reject) => {
|
||||
const zipFile = new zip()
|
||||
zipFile.addLocalFolder(archivePath)
|
||||
zipFile.writeZip(archivePath + ".zip", (error) => {
|
||||
return error ? reject(error) : resolve(error)
|
||||
})
|
||||
}),
|
||||
])
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
server.on("error", reject)
|
||||
server.on("listening", resolve)
|
||||
server.listen({
|
||||
port: 0,
|
||||
host: "localhost",
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
after(() => {
|
||||
@ -205,18 +211,15 @@ describe("update", () => {
|
||||
assert.equal(`console.log("OLD")`, await fs.readFile(entry, "utf8"))
|
||||
|
||||
// Updating should replace the existing version.
|
||||
await p.downloadAndApplyUpdate(update, destination, "linux")
|
||||
await p.downloadAndApplyUpdate(update, destination)
|
||||
assert.equal(`console.log("UPDATED")`, await fs.readFile(entry, "utf8"))
|
||||
|
||||
// Should still work if there is no existing version somehow.
|
||||
await fs.remove(destination)
|
||||
await p.downloadAndApplyUpdate(update, destination, "linux")
|
||||
await p.downloadAndApplyUpdate(update, destination)
|
||||
assert.equal(`console.log("UPDATED")`, await fs.readFile(entry, "utf8"))
|
||||
|
||||
assert.deepEqual(spy, [
|
||||
"/latest",
|
||||
`/download/${version}/code-server-${version}-linux-x86_64.tar.gz`,
|
||||
`/download/${version}/code-server-${version}-linux-x86_64.tar.gz`,
|
||||
])
|
||||
const archiveName = await p.getReleaseName(update)
|
||||
assert.deepEqual(spy, ["/latest", `/download/${version}/${archiveName}`, `/download/${version}/${archiveName}`])
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user