-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.ts
31 lines (26 loc) · 902 Bytes
/
test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { image, workdir, stage, from, copy, run, arg, dockerfile } from "./dist";
const nodeImage = image('node', { tag: '10-alpine' });
const wd = workdir('/opt/app');
const base = stage('base')
.from(nodeImage)
.commands(
wd,
copy('package.json', 'package.raw.json'),
copy('yarn.lock'),
run(`node -e "const pkg = require('./package.raw.json');
delete pkg.version;
console.log(JSON.stringify(pkg))" > package.dev.json`),
run(`node -e "const pkg = require('./package.raw.json');
delete pkg.version;
delete pkg.devDependencies;
console.log(JSON.stringify(pkg))" > package.json`)
)
const npmrc = arg('NPMRC');
const build = stage()
.from(base)
.commands(
wd,
npmrc,
run(`echo "${npmrc}" > /root/.npmrc`)
)
export default async () => dockerfile().stages(base, build);