From 17fad8287935405c1f0a06230a9d3ae44306685e Mon Sep 17 00:00:00 2001 From: Kien La Date: Mon, 2 Dec 2024 18:10:26 -0500 Subject: [PATCH] fix rebuild to handle multiple services properly --- src/app.ts | 9 +++++++-- src/container.ts | 12 ------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/app.ts b/src/app.ts index ffa94f5..7a58f47 100644 --- a/src/app.ts +++ b/src/app.ts @@ -165,8 +165,13 @@ export default class App { } async rebuild(config: StaxConfig, options: SetupOptions = {}) { - for (const container of this.containers) - await container.rebuild(config, options) + config = { + ...this.primary.config, + ...config, + // can't change following on a rebuild + context: this.context, source: this.primary.source, staxfile: this.primary.staxfile + } + await this.constructor.setup(config, { ...options, rebuild: true }) } async duplicate(newName: string, config: StaxConfig, options: SetupOptions = {}) { diff --git a/src/container.ts b/src/container.ts index 419f4f8..684c9a3 100644 --- a/src/container.ts +++ b/src/container.ts @@ -5,7 +5,6 @@ import { linkSshAuthSock } from '~/host_services' import { timeAgo } from '~/utils' import docker from '~/docker' import Staxfile from '~/staxfile' -import App from './app' import Config from './staxfile/config' import icons from './icons' @@ -157,17 +156,6 @@ export default class Container { return await docker.compose(this.context, `run --rm ${args} ${this.name} ${command}`, this.composeFile, options) } - async rebuild(config: StaxConfig, options: SetupOptions = {}) { - config = { - ...this.config, - ...config, - // can't change following on a rebuild - context: this.context, source: this.source, staxfile: this.staxfile - } - - await App.setup(config, { ...options, rebuild: true }) - } - async shell() { const shells = ['/bin/zsh', '/bin/bash'] const shellCommand = `sh -c '${shells.map(shell => `[ -f ${shell} ] && exec ${shell}`).join(' || ')} || exec /bin/sh'`