mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-26 18:58:21 +02:00
Revert "Server: Enable multi platform builds (amd64, armv7 and arm64) (#5338)"
This reverts commit ab134807eae53b303fe8bb054ec5808543fa9624. Does not build: https://github.com/laurent22/joplin/runs/3597996286?check_suite_focus=true#step:8:388
This commit is contained in:
parent
b00959e143
commit
a661a73511
8
.github/workflows/github-actions-main.yml
vendored
8
.github/workflows/github-actions-main.yml
vendored
@ -35,14 +35,6 @@ jobs:
|
|||||||
sudo apt-get update || true
|
sudo apt-get update || true
|
||||||
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
|
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: actions/checkout@v2
|
||||||
- uses: olegtarasov/get-tag@v2.1
|
- uses: olegtarasov/get-tag@v2.1
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import { execCommand2, rootDir } from './tool-utils';
|
import { execCommand2, rootDir } from './tool-utils';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
|
|
||||||
const DockerImageName = 'joplin/server';
|
|
||||||
|
|
||||||
function getVersionFromTag(tagName: string, isPreRelease: boolean): string {
|
function getVersionFromTag(tagName: string, isPreRelease: boolean): string {
|
||||||
if (tagName.indexOf('server-') !== 0) throw new Error(`Invalid tag: ${tagName}`);
|
if (tagName.indexOf('server-') !== 0) throw new Error(`Invalid tag: ${tagName}`);
|
||||||
const s = tagName.split('-');
|
const s = tagName.split('-');
|
||||||
@ -14,10 +12,6 @@ function getIsPreRelease(tagName: string): boolean {
|
|||||||
return tagName.indexOf('-beta') > 0;
|
return tagName.indexOf('-beta') > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizePlatform(platform: string) {
|
|
||||||
return platform.replace(/\//g, '-');
|
|
||||||
}
|
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const argv = require('yargs').argv;
|
const argv = require('yargs').argv;
|
||||||
if (!argv.tagName) throw new Error('--tag-name not provided');
|
if (!argv.tagName) throw new Error('--tag-name not provided');
|
||||||
@ -33,11 +27,7 @@ async function main() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.info('Could not get git commit: metadata revision field will be empty');
|
console.info('Could not get git commit: metadata revision field will be empty');
|
||||||
}
|
}
|
||||||
const buildArgs = [
|
const buildArgs = `--build-arg BUILD_DATE="${buildDate}" --build-arg REVISION="${revision}" --build-arg VERSION="${imageVersion}"`;
|
||||||
`--build-arg BUILD_DATE="${buildDate}"`,
|
|
||||||
`--build-arg REVISION="${revision}"`,
|
|
||||||
`--build-arg VERSION="${imageVersion}"`,
|
|
||||||
];
|
|
||||||
const dockerTags: string[] = [];
|
const dockerTags: string[] = [];
|
||||||
const versionPart = imageVersion.split('.');
|
const versionPart = imageVersion.split('.');
|
||||||
dockerTags.push(isPreRelease ? 'beta' : 'latest');
|
dockerTags.push(isPreRelease ? 'beta' : 'latest');
|
||||||
@ -54,48 +44,10 @@ async function main() {
|
|||||||
console.info('isPreRelease:', isPreRelease);
|
console.info('isPreRelease:', isPreRelease);
|
||||||
console.info('Docker tags:', dockerTags.join(', '));
|
console.info('Docker tags:', dockerTags.join(', '));
|
||||||
|
|
||||||
const platforms = [
|
await execCommand2(`docker build -t "joplin/server:${imageVersion}" ${buildArgs} -f Dockerfile.server .`);
|
||||||
'linux/amd64',
|
for (const tag of dockerTags) {
|
||||||
'linux/arm64',
|
await execCommand2(`docker tag "joplin/server:${imageVersion}" "joplin/server:${tag}"`);
|
||||||
'linux/arm/v7',
|
if (pushImages) await execCommand2(`docker push joplin/server:${tag}`);
|
||||||
];
|
|
||||||
|
|
||||||
// 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}`,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,6 @@ export function execCommandVerbose(commandName: string, args: string[] = []) {
|
|||||||
interface ExecCommandOptions {
|
interface ExecCommandOptions {
|
||||||
showInput?: boolean;
|
showInput?: boolean;
|
||||||
showOutput?: boolean;
|
showOutput?: boolean;
|
||||||
showError?: boolean;
|
|
||||||
quiet?: boolean;
|
quiet?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +160,6 @@ export async function execCommand2(command: string | string[], options: ExecComm
|
|||||||
options = {
|
options = {
|
||||||
showInput: true,
|
showInput: true,
|
||||||
showOutput: true,
|
showOutput: true,
|
||||||
showError: true,
|
|
||||||
quiet: false,
|
quiet: false,
|
||||||
...options,
|
...options,
|
||||||
};
|
};
|
||||||
@ -169,7 +167,6 @@ export async function execCommand2(command: string | string[], options: ExecComm
|
|||||||
if (options.quiet) {
|
if (options.quiet) {
|
||||||
options.showInput = false;
|
options.showInput = false;
|
||||||
options.showOutput = false;
|
options.showOutput = false;
|
||||||
options.showError = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.showInput) {
|
if (options.showInput) {
|
||||||
@ -185,7 +182,6 @@ export async function execCommand2(command: string | string[], options: ExecComm
|
|||||||
args.splice(0, 1);
|
args.splice(0, 1);
|
||||||
const promise = execa(executableName, args);
|
const promise = execa(executableName, args);
|
||||||
if (options.showOutput) promise.stdout.pipe(process.stdout);
|
if (options.showOutput) promise.stdout.pipe(process.stdout);
|
||||||
if (options.showError) promise.stderr.pipe(process.stderr);
|
|
||||||
const result = await promise;
|
const result = await promise;
|
||||||
return result.stdout.trim();
|
return result.stdout.trim();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user