mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Remove directory from dockerfiles target (#37258)
* Remove directory from dockerfiles target Produce a docker build context tarball without a top-level directory to match the expected format for downstream automation. This will produce: ``` $ tar -tzf target/kibana-8.0.0-docker-build-context.tar.gz Dockerfile bin/ config/ bin/kibana-docker config/kibana.yml ``` Instead of: ``` $ tar -tzf target/kibana-8.0.0-docker-build-context.tar.gz kibana-8.0.0-docker-build-context/Dockerfile kibana-8.0.0-docker-build-context/bin/ kibana-8.0.0-docker-build-context/config/ kibana-8.0.0-docker-build-context/bin/kibana-docker kibana-8.0.0-docker-build-context/config/kibana.yml ``` * Use options object for root directory config
This commit is contained in:
parent
1ea4b5499e
commit
2f162d44ef
3 changed files with 36 additions and 8 deletions
|
@ -188,8 +188,8 @@ export async function untar(source, destination, extractOptions = {}) {
|
|||
|
||||
export async function compress(type, options = {}, source, destination) {
|
||||
const output = fs.createWriteStream(destination);
|
||||
const archive = archiver(type, options);
|
||||
const name = source.split(sep).slice(-1)[0];
|
||||
const archive = archiver(type, options.archiverOptions);
|
||||
const name = (options.createRootDirectory ? source.split(sep).slice(-1)[0] : false);
|
||||
|
||||
archive.pipe(output);
|
||||
|
||||
|
|
|
@ -34,11 +34,36 @@ export const CreateArchivesTask = {
|
|||
|
||||
switch (path.extname(destination)) {
|
||||
case '.zip':
|
||||
await compress('zip', { zlib: { level: 9 } }, source, destination);
|
||||
await compress(
|
||||
'zip',
|
||||
{
|
||||
archiverOptions: {
|
||||
zlib: {
|
||||
level: 9
|
||||
}
|
||||
},
|
||||
createRootDirectory: true
|
||||
},
|
||||
source,
|
||||
destination
|
||||
);
|
||||
break;
|
||||
|
||||
case '.gz':
|
||||
await compress('tar', { gzip: true, gzipOptions: { level: 9 } }, source, destination);
|
||||
await compress(
|
||||
'tar',
|
||||
{
|
||||
archiverOptions: {
|
||||
gzip: true,
|
||||
gzipOptions: {
|
||||
level: 9
|
||||
}
|
||||
},
|
||||
createRootDirectory: true
|
||||
},
|
||||
source,
|
||||
destination
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -59,10 +59,13 @@ export async function bundleDockerFiles(config, log, build, scope) {
|
|||
await compress(
|
||||
'tar',
|
||||
{
|
||||
gzip: true,
|
||||
gzipOptions: {
|
||||
level: 9
|
||||
}
|
||||
archiverOptions: {
|
||||
gzip: true,
|
||||
gzipOptions: {
|
||||
level: 9
|
||||
}
|
||||
},
|
||||
createRootDirectory: false
|
||||
},
|
||||
dockerFilesBuildDir,
|
||||
dockerFilesOutputDir
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue