diff --git a/README.md b/README.md index 4b9d3fb16..e7e46bd91 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,9 @@

-> New in v4.7: -> Register with user profile enabled: Out of the box `options` validator support. -> [Example](https://user-images.githubusercontent.com/6702424/158911163-81e6bbe8-feb0-4dc8-abff-de199d7a678e.mov) +> New with v4.7.2: **M1 Mac** support (for testing locally with a dockerized Keycloak). +> Thanks goes to [@eduardosanzb](https://github.com/InseeFrLab/keycloakify/issues/43#issuecomment-975699658). +> Be aware: When running M1s you are testing with Keycloak v15 else the local container spun will be a Keycloak v16.1.0. # Motivations @@ -478,6 +478,11 @@ and `kcRegisterContext["authorizedMailDomains"]` to validate on. # Changelog highlights +# v4.7.2 + +Testing with local Keycloak container working with M1 Mac. Thanks to [@eduardosanzb](https://github.com/InseeFrLab/keycloakify/issues/43#issuecomment-975699658). +Be aware: When running M1s you are testing with Keycloak v15 else the local container spun will be a Keycloak v16.1.0. + # v4.7.0 Register with user profile enabled: Out of the box `options` validator support. diff --git a/src/bin/build-keycloak-theme/build-keycloak-theme.ts b/src/bin/build-keycloak-theme/build-keycloak-theme.ts index cee75fd13..5bcf65835 100644 --- a/src/bin/build-keycloak-theme/build-keycloak-theme.ts +++ b/src/bin/build-keycloak-theme/build-keycloak-theme.ts @@ -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( diff --git a/src/bin/build-keycloak-theme/generateDebugFiles/generateDebugFiles.ts b/src/bin/build-keycloak-theme/generateDebugFiles/generateDebugFiles.ts index 4dea489e8..d31ff5bba 100644 --- a/src/bin/build-keycloak-theme/generateDebugFiles/generateDebugFiles.ts +++ b/src/bin/build-keycloak-theme/generateDebugFiles/generateDebugFiles.ts @@ -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", "", diff --git a/src/bin/tools/isM1.ts b/src/bin/tools/isM1.ts new file mode 100644 index 000000000..7233bb192 --- /dev/null +++ b/src/bin/tools/isM1.ts @@ -0,0 +1,5 @@ +import * as os from "os"; + +export function getIsM1() { + return os.cpus()[0].model.includes("Apple M1"); +}