From 6503e571744c60f837b422e1591dbe01ffa8082a Mon Sep 17 00:00:00 2001 From: NGPixel Date: Wed, 26 Oct 2022 03:10:17 -0400 Subject: [PATCH] ci: deploy to container workflow - remove anonymous volumes on db delete --- dev/deploy-to-container/cli.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dev/deploy-to-container/cli.js b/dev/deploy-to-container/cli.js index 6d92056d5..025efc389 100644 --- a/dev/deploy-to-container/cli.js +++ b/dev/deploy-to-container/cli.js @@ -84,12 +84,16 @@ async function main () { const containers = await dock.listContainers({ all: true }) for (const container of containers) { if (container.Names.includes(`/dt-db-${branch}`) || container.Names.includes(`/dt-app-${branch}`)) { + const isDbContainer = container.Names.includes(`/dt-db-${branch}`) console.info(`Terminating old container ${container.Id}...`) const oldContainer = dock.getContainer(container.Id) if (container.State === 'running') { await oldContainer.stop({ t: 5 }) } - await oldContainer.remove({ force: true }) + await oldContainer.remove({ + force: true, + v: isDbContainer + }) } } console.info('Existing containers with same name have been terminated.')