-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[build] Use docker to manage dependencies
- Loading branch information
Showing
13 changed files
with
192 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.aws-config.json | ||
.signing-config.json | ||
.node_binaries | ||
node_modules | ||
optimize | ||
target | ||
build | ||
html_docs | ||
esvm | ||
plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
ARG node_version | ||
FROM node:$node_version | ||
|
||
ARG kibana_folder | ||
|
||
RUN set -x && \ | ||
apt-get update && \ | ||
apt-get install -y \ | ||
ruby-dev \ | ||
ruby \ | ||
zip \ | ||
rpm | ||
RUN gem install bundler | ||
|
||
RUN groupadd --gid 1010 kibana \ | ||
&& useradd --uid 1010 --gid kibana --shell /bin/bash --create-home kibana | ||
|
||
RUN mkdir -p $kibana_folder | ||
COPY . $kibana_folder | ||
RUN chown -R kibana:kibana $kibana_folder | ||
|
||
USER kibana | ||
|
||
WORKDIR /tmp | ||
COPY tasks/build/docker/packages/Gemfile . | ||
COPY tasks/build/docker/packages/Gemfile.lock . | ||
RUN bundle install --deployment | ||
ENV BUNDLE_GEMFILE=/tmp/Gemfile | ||
|
||
WORKDIR $kibana_folder | ||
ENV NPM_CONFIG_LOGLEVEL error | ||
RUN npm install | ||
|
||
|
||
CMD node_modules/.bin/grunt build $BUILD_OPTIONS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source "https://rubygems.org" | ||
gem "pleaserun", "= 0.0.24" | ||
gem "fpm", "=1.5.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
archive-tar-minitar (0.6.1) | ||
minitar (~> 0.6) | ||
minitar-cli (~> 0.6) | ||
arr-pm (0.0.10) | ||
cabin (> 0) | ||
backports (3.8.0) | ||
cabin (0.9.0) | ||
childprocess (0.7.1) | ||
ffi (~> 1.0, >= 1.0.11) | ||
clamp (0.6.5) | ||
corefines (1.10.0) | ||
ffi (1.9.18) | ||
fpm (1.5.0) | ||
archive-tar-minitar | ||
arr-pm (~> 0.0.10) | ||
backports (>= 2.6.2) | ||
cabin (>= 0.6.0) | ||
childprocess | ||
clamp (~> 0.6) | ||
corefines (~> 1.9) | ||
ffi | ||
json (>= 1.7.7) | ||
ruby-xz | ||
hashie (3.5.6) | ||
insist (1.0.0) | ||
io-like (0.3.0) | ||
json (2.1.0) | ||
minitar (0.6.1) | ||
minitar-cli (0.6.1) | ||
minitar (~> 0.6.0) | ||
powerbar (~> 1.0) | ||
mustache (0.99.8) | ||
pleaserun (0.0.24) | ||
cabin (> 0) | ||
clamp | ||
insist | ||
mustache (= 0.99.8) | ||
stud | ||
powerbar (1.0.18) | ||
hashie (>= 1.1.0) | ||
ruby-xz (0.2.3) | ||
ffi (~> 1.9) | ||
io-like (~> 0.3) | ||
stud (0.0.23) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
fpm (= 1.5.0) | ||
pleaserun (= 0.0.24) | ||
|
||
BUNDLED WITH | ||
1.15.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: '2' | ||
services: | ||
kibana_build: | ||
container_name: $KIBANA_BUILD_CONTAINER_NAME | ||
environment: | ||
- BUILD_OPTIONS=$KIBANA_BUILD_OPTIONS | ||
build: | ||
context: $KIBANA_BUILD_CONTEXT | ||
dockerfile: $KIBANA_BUILD_CONTEXT/tasks/build/docker/packages/Dockerfile | ||
args: | ||
- node_version=$KIBANA_NODE_VERSION | ||
- kibana_folder=$KIBANA_FOLDER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import rimraf from 'rimraf'; | ||
import { join } from 'path'; | ||
import { execFileSync as exec } from 'child_process'; | ||
|
||
module.exports = function (grunt) { | ||
grunt.registerTask('docker:packages', 'Build packages from docker', function () { | ||
const composePath = join(grunt.config.get('root'), 'tasks/build/docker/packages/docker-compose.yml'); | ||
const env = Object.assign(process.env, { | ||
KIBANA_NODE_VERSION: grunt.config.get('nodeVersion'), | ||
KIBANA_BUILD_CONTEXT: grunt.config.get('root'), | ||
KIBANA_BUILD_OPTIONS: grunt.option.flags().join(' '), | ||
KIBANA_BUILD_CONTAINER_NAME: 'kibana_build', | ||
KIBANA_FOLDER: '/home/kibana/repo' | ||
}); | ||
const stdio = [0, 1, 2]; | ||
const execOptions = { env, stdio }; | ||
|
||
const useCache = grunt.option('cache'); | ||
|
||
const targetDir = join(grunt.config.get('root'), 'target'); | ||
const buildDir = join(grunt.config.get('root'), 'build'); | ||
|
||
exec('docker-compose', [ | ||
'-f', composePath, | ||
'build', | ||
useCache ? '' : '--no-cache', | ||
].filter(Boolean), execOptions); | ||
exec('docker-compose', [ | ||
'-f', composePath, | ||
'up' | ||
], execOptions); | ||
|
||
const containerId = String(exec('docker-compose', [ | ||
'-f', composePath, | ||
'ps', | ||
'-q', env.KIBANA_BUILD_CONTAINER_NAME | ||
], { env })).trim(); | ||
|
||
rimraf.sync(targetDir); | ||
rimraf.sync(buildDir); | ||
|
||
exec('docker', [ | ||
'cp', | ||
`${containerId}:${env.KIBANA_FOLDER}/target`, | ||
targetDir | ||
]); | ||
exec('docker', [ | ||
'cp', | ||
`${containerId}:${env.KIBANA_FOLDER}/build`, | ||
buildDir | ||
], execOptions); | ||
|
||
exec('docker-compose', [ | ||
'-f', composePath, | ||
'rm', | ||
'--force' | ||
], execOptions); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters