#43: M1 Mac support

This commit is contained in:
garronej
2022-04-07 01:35:19 +02:00
parent 79aa5ac5f2
commit 20383d60a9
4 changed files with 23 additions and 5 deletions

View File

@ -5,6 +5,7 @@ import * as child_process from "child_process";
import { generateDebugFiles, containerLaunchScriptBasename } from "./generateDebugFiles";
import { URL } from "url";
import * as fs from "fs";
import { getIsM1 } from "../tools/isM1";
type ParsedPackageJson = {
name: string;
@ -92,7 +93,9 @@ export function main() {
keycloakThemeBuildingDirPath,
themeName,
//We want, however to test in a container running the latest Keycloak version
"keycloakVersion": "16.1.0",
//Except on M1 where we can't use the default image and we only have
//https://github.com/InseeFrLab/keycloakify/issues/43#issuecomment-975699658
"keycloakVersion": getIsM1() ? "15.0.2" : "16.1.0",
});
console.log(

View File

@ -1,6 +1,7 @@
import * as fs from "fs";
import { join as pathJoin, dirname as pathDirname } from "path";
import type { KeycloakVersion } from "../../KeycloakVersion";
import { getIsM1 } from "../../tools/isM1";
export const containerLaunchScriptBasename = "start_keycloak_testing_container.sh";
@ -12,7 +13,11 @@ export function generateDebugFiles(params: { keycloakVersion: KeycloakVersion; t
pathJoin(keycloakThemeBuildingDirPath, "Dockerfile"),
Buffer.from(
[
`FROM jboss/keycloak:${keycloakVersion}`,
`FROM ${
getIsM1()
? "eduardosanzb/keycloak@sha256:b1f5bc674eaff6f4e7b37808b9863440310ff93c282fc9bff812377be48bf519"
: `jboss/keycloak:${keycloakVersion}`
}`,
"",
"USER root",
"",

5
src/bin/tools/isM1.ts Normal file
View File

@ -0,0 +1,5 @@
import * as os from "os";
export function getIsM1() {
return os.cpus()[0].model.includes("Apple M1");
}