Skip to content
Permalink
v2.4.1
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
36 lines (30 sloc) 754 Bytes
import fs from 'fs'
export function getImageName(dockerfileName: string): string {
const dockerfile = fs.readFileSync(
require.resolve(`../docker/${dockerfileName}`),
'utf8'
)
const imageName = dockerfile
.split(/\n/)
.find(a => a.startsWith('FROM'))
?.replace('FROM', '')
.trim()
if (!imageName) {
throw new Error(`Could not find an image name in ${dockerfile}`)
}
return imageName
}
const manifest = {
proxy: getImageName('Dockerfile.proxy'),
updater: getImageName('Dockerfile.updater')
}
fs.writeFile(
require.resolve(`../docker/containers.json`),
JSON.stringify(manifest, null, 2),
function (err) {
if (err) {
// eslint-disable-next-line no-console
console.log(err)
}
}
)