From c431cee51764dc5799f6e701518e4e03d59b450a Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 10 Nov 2022 15:01:03 +0100 Subject: [PATCH] fix: wp + mysql on arm --- apps/api/src/lib/common.ts | 2 +- apps/api/src/lib/services/handlers.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/api/src/lib/common.ts b/apps/api/src/lib/common.ts index dfdde81d2..e2afeb3e5 100644 --- a/apps/api/src/lib/common.ts +++ b/apps/api/src/lib/common.ts @@ -972,7 +972,7 @@ export function generateDatabaseConfiguration(database: any, arch: string): Data } } export function isARM(arch: string) { - if (arch === 'arm' || arch === 'arm64') { + if (arch === 'arm' || arch === 'arm64' || arch === 'aarch' || arch === 'aarch64') { return true; } return false; diff --git a/apps/api/src/lib/services/handlers.ts b/apps/api/src/lib/services/handlers.ts index 2d4c47caa..56ffb2e1f 100644 --- a/apps/api/src/lib/services/handlers.ts +++ b/apps/api/src/lib/services/handlers.ts @@ -34,7 +34,7 @@ export async function startService(request: FastifyRequest, fa const { id } = request.params; const teamId = request.user.teamId; const service = await getServiceFromDB({ id, teamId }); - const arm = isARM(service.arch) + const arm = isARM(process.arch); const { type, destinationDockerId, destinationDocker, persistentStorage, exposePort } = service; @@ -107,14 +107,16 @@ export async function startService(request: FastifyRequest, fa if (template.services[s].ports?.length > 0) { port = template.services[s].ports[0] } - console.log({ arm }) - console.log(template.services[s].imageArm) + let image = template.services[s].image + if (arm && template.services[s].imageArm) { + image = template.services[s].imageArm + } config[s] = { container_name: s, build: template.services[s].build || undefined, command: template.services[s].command, entrypoint: template.services[s]?.entrypoint, - image: arm ? template.services[s].imageArm : template.services[s].image, + image, expose: template.services[s].ports, ...(exposePort ? { ports: [`${exposePort}:${port}`] } : {}), volumes: Array.from(volumes), @@ -126,6 +128,7 @@ export async function startService(request: FastifyRequest, fa labels: makeLabelForServices(type), ...defaultComposeConfiguration(network), } + console.log(config[s].image) // Generate files for builds if (template.services[s]?.files?.length > 0) {