1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

Revert "Server: Enable multi platform builds (amd64, armv7 and arm64) (#5338)"

This reverts commit ab134807ea.

Does not build:

https://github.com/laurent22/joplin/runs/3597996286?check_suite_focus=true#step:8:388
This commit is contained in:
Laurent Cozic 2021-09-14 13:01:33 +01:00
parent b00959e143
commit a661a73511
3 changed files with 5 additions and 65 deletions

View File

@ -35,14 +35,6 @@ jobs:
sudo apt-get update || true
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# the next line enables multi-architecture support for docker, it basically makes it use qemu for non native platforms
# See https://hub.docker.com/r/tonistiigi/binfmt for more info
docker run --privileged --rm tonistiigi/binfmt --install all
# this just prints the info about what platforms are supported in the builder (can help debugging if something isn't working right)
# and also proves the above worked properly
sudo docker buildx ls
- uses: actions/checkout@v2
- uses: olegtarasov/get-tag@v2.1
- uses: actions/setup-node@v2

View File

@ -1,8 +1,6 @@
import { execCommand2, rootDir } from './tool-utils';
import * as moment from 'moment';
const DockerImageName = 'joplin/server';
function getVersionFromTag(tagName: string, isPreRelease: boolean): string {
if (tagName.indexOf('server-') !== 0) throw new Error(`Invalid tag: ${tagName}`);
const s = tagName.split('-');
@ -14,10 +12,6 @@ function getIsPreRelease(tagName: string): boolean {
return tagName.indexOf('-beta') > 0;
}
function normalizePlatform(platform: string) {
return platform.replace(/\//g, '-');
}
async function main() {
const argv = require('yargs').argv;
if (!argv.tagName) throw new Error('--tag-name not provided');
@ -33,11 +27,7 @@ async function main() {
} catch (error) {
console.info('Could not get git commit: metadata revision field will be empty');
}
const buildArgs = [
`--build-arg BUILD_DATE="${buildDate}"`,
`--build-arg REVISION="${revision}"`,
`--build-arg VERSION="${imageVersion}"`,
];
const buildArgs = `--build-arg BUILD_DATE="${buildDate}" --build-arg REVISION="${revision}" --build-arg VERSION="${imageVersion}"`;
const dockerTags: string[] = [];
const versionPart = imageVersion.split('.');
dockerTags.push(isPreRelease ? 'beta' : 'latest');
@ -54,48 +44,10 @@ async function main() {
console.info('isPreRelease:', isPreRelease);
console.info('Docker tags:', dockerTags.join(', '));
const platforms = [
'linux/amd64',
'linux/arm64',
'linux/arm/v7',
];
// this will build a bunch of local image tags named: ${imageVersion}-${platform} with the slashes replaced with dashes
for (const platform of platforms) {
const normalizedPlatform = normalizePlatform(platform);
await execCommand2([
'docker', 'build',
'--platform', platform,
'-t', `${DockerImageName}:${imageVersion}-${normalizedPlatform}`,
...buildArgs,
'-f', 'Dockerfile.server',
'.',
]);
if (pushImages) {
await execCommand2([
'docker', 'push', `${DockerImageName}:${imageVersion}-${normalizedPlatform}`,
]);
}
}
// now we have to create the right manifests and push them
if (pushImages) {
for (const tag of dockerTags) {
// manifest create requires the tags being amended in to exist on the remote, so this all can only happen if pushImages is true
const platformArgs: string[] = [];
for (const platform in platforms) {
platformArgs.concat('--amend', `${DockerImageName}:${imageVersion}-${normalizePlatform(platform)}`);
}
await execCommand2([
'docker', 'manifest', 'create',
`${DockerImageName}:${tag}`,
...platformArgs,
]);
await execCommand2([
'docker', 'manifest', 'push',
`${DockerImageName}:${tag}`,
]);
}
await execCommand2(`docker build -t "joplin/server:${imageVersion}" ${buildArgs} -f Dockerfile.server .`);
for (const tag of dockerTags) {
await execCommand2(`docker tag "joplin/server:${imageVersion}" "joplin/server:${tag}"`);
if (pushImages) await execCommand2(`docker push joplin/server:${tag}`);
}
}

View File

@ -147,7 +147,6 @@ export function execCommandVerbose(commandName: string, args: string[] = []) {
interface ExecCommandOptions {
showInput?: boolean;
showOutput?: boolean;
showError?: boolean;
quiet?: boolean;
}
@ -161,7 +160,6 @@ export async function execCommand2(command: string | string[], options: ExecComm
options = {
showInput: true,
showOutput: true,
showError: true,
quiet: false,
...options,
};
@ -169,7 +167,6 @@ export async function execCommand2(command: string | string[], options: ExecComm
if (options.quiet) {
options.showInput = false;
options.showOutput = false;
options.showError = false;
}
if (options.showInput) {
@ -185,7 +182,6 @@ export async function execCommand2(command: string | string[], options: ExecComm
args.splice(0, 1);
const promise = execa(executableName, args);
if (options.showOutput) promise.stdout.pipe(process.stdout);
if (options.showError) promise.stderr.pipe(process.stderr);
const result = await promise;
return result.stdout.trim();
}