Skip to content

Commit

Permalink
fix rebuild to handle multiple services properly
Browse files Browse the repository at this point in the history
  • Loading branch information
kla committed Dec 2, 2024
1 parent 8d9b3e5 commit 17fad82
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
9 changes: 7 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}) {
Expand Down
12 changes: 0 additions & 12 deletions src/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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'`
Expand Down

0 comments on commit 17fad82

Please sign in to comment.