var Dockerfile = require("dockerfilejs").Dockerfile;
var file = new Dockerfile();
file.comment('The above code example yields this file!')
.env({DEBUG:'express:* node index.js'})
.expose(8080)
.separator('\n')
.from({ image : 'node', tag : 'latest'})
.comment('FROM gets bumped under initial comments')
.render();
file.separator('\n')
file.label({ complex: { objects: 'allowed' } });
file.expose([8080, '8081', { number: 443, protocol: 'tcp' }]);
file.run({ command: ['touch /file.txt', ['echo', 'hello world', '>>', '/file.txt'] ] });
file.copy({ src : ['/id_rsa', '/id_rsa.pub'], dest: '/root/.ssh/' }, true);
file.copy({ src : ['/id_rsa', '/id_rsa.pub'], dest: '/root/.ssh/', onbuild: true });
file.copy({ src : ['/id_rsa'], dest: '/root/.ssh/', chown: '0:0' });
file.copy({ src : ['/id_rsa'], dest: '/root/.ssh/', user: 0, group: 0 });
file.copy({ src : ['/id_rsa'], dest: '/root/.ssh/', chown: { user: 0, group: 0 });
file.cmd({ executable: '/bin/bash', params: ['-c', 'hello world'] });
file.cmd({ command:'/bin/bash', params: ['-c', 'hello world'] })
file.healthCheck({
options: { retries: 4, timeout: '30s'},
command: 'wget',
params: ['example.com']
})
file.user('root');
file.from({ image: 'node', tag: '10-alpine', name: 'build' })
file.stage()
file.from({ image: 'node', registry: 'docker.io', tag: '10-alpine' })
file.copy({ from: 'build', src: ['./lib'], dest: './lib' })