Create service dockerising stuff
This commit is contained in:
24
createMissingContainers.ts
Normal file
24
createMissingContainers.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
for await (const service of Deno.readDir('.')) {
|
||||
if (service.isFile || !service.name.includes('-service')) continue;
|
||||
|
||||
const serviceFile = './' + service.name + '/';
|
||||
const serviceName = service.name.replace('-service', '');
|
||||
const port = await Deno.readTextFile(serviceFile + 'port');
|
||||
const perms = (await Deno.readTextFile(serviceFile + 'perms')).split('\n');
|
||||
await Deno.writeTextFile(serviceFile + 'Dockerfile', `
|
||||
FROM denoland/deno:1.33.2
|
||||
${port ? 'EXPOSE ' + port : ''}
|
||||
|
||||
WORKDIR /${serviceName}
|
||||
|
||||
ADD ./user-service .
|
||||
COPY ./deno.jsonc .
|
||||
COPY ./secrets.json .
|
||||
COPY ./key.txt .
|
||||
ADD ./common ./common
|
||||
ADD ./lib ./lib
|
||||
ADD ./middleware ./middleware
|
||||
|
||||
CMD ["run", "${perms.join('", "')}", main.ts${port ? `, "${port}"` : ''}]
|
||||
`);
|
||||
}
|
Reference in New Issue
Block a user