I am trying to publish docker image with latest and current version tag. Calling publish multiple time works but the pipeline also runs multiple time. I can can see that the application is being built two times.
Is there a way to publish image with multiple tags without executing the whole pipeline again ?
async function pipeline(client: Client) {
// Create base image that has pnpm
const base = () => {
return client.container().from('node:18.15.0-alpine').withExec(['corepack', 'enable'])
}
//...
// Create the final image that runs the application
const image = base()
.withExec(['apk', 'add', 'ffmpeg', 'yt-dlp'])
.withWorkdir('/app')
.withDirectory('node_modules', production.directory('node_modules'))
.withDirectory('dist', build.directory('dist'))
.withFile('package.json', build.file('package.json'))
.withExposedPort(3000)
.withEntrypoint(['node', 'dist/index.js'])
// Publish the image to registry
const password = client.setSecret('docker-hub-password', REGISTRY_PASSWORD)
const authed = image.withRegistryAuth(REGISTRY_URL, REGISTRY_USERNAME, password)
await authed.publish(`${REGISTRY_USERNAME}/botto:latest`)
await authed.publish(`${REGISTRY_USERNAME}/botto:${info.version}`)
}
// Run the pipeline
await connect(pipeline, { LogOutput: process.stdout })