From af003b28d1891876952af63eba0652ec48baf511 Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Sat, 22 Apr 2017 02:10:00 +0200 Subject: [PATCH 1/3] more docker work --- .dockerignore | 7 ++ .travis.yml | 14 ++-- docker-compose.yml | 2 +- docker/Dockerfile | 65 +++++++++---------- .../docker-compose.development.override.yml | 6 +- 5 files changed, 54 insertions(+), 40 deletions(-) diff --git a/.dockerignore b/.dockerignore index d79466af1d..671d2295c4 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,6 +5,10 @@ docker-compose*.yml docker/ !docker/msfconsole.rc README.md +.git/ +.github/ +.ruby-version +.ruby-gemset .bundle Gemfile.local @@ -93,3 +97,6 @@ data/meterpreter/ext_server_pivot.*.dll # https://rapid7.github.io/metasploit-framework. It's an orphan branch. /metakitty .vagrant + +# no need for rspecs +spec/ diff --git a/.travis.yml b/.travis.yml index a94cf3ad57..e6a9560d71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,12 +16,15 @@ rvm: - '2.4.1' env: - - RAKE_TASKS="cucumber cucumber:boot" CREATE_BINSTUBS=true - - RAKE_TASKS=spec SPEC_OPTS="--tag content" - - RAKE_TASKS=spec SPEC_OPTS="--tag ~content" + - CMD=bundle exec rake "cucumber cucumber:boot" CREATE_BINSTUBS=true + - CMD=bundle exec rake spec SPEC_OPTS="--tag content" + - CMD=bundle exec rake spec SPEC_OPTS="--tag ~content" matrix: fast_finish: true + include: + - rvm: ruby-head + env: CMD=docker-compose -f $TRAVIS_BUILD_DIR/docker-compose.yml build before_install: - "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc" - rake --version @@ -36,7 +39,7 @@ before_script: - bundle exec rake db:migrate script: # fail build if db/schema.rb update is not committed - - git diff --exit-code db/schema.rb && bundle exec rake $RAKE_TASKS + - git diff --exit-code db/schema.rb && $CMD notifications: irc: "irc.freenode.org#msfnotify" @@ -49,3 +52,6 @@ branches: except: - gh-pages - metakitty + +services: + - docker diff --git a/docker-compose.yml b/docker-compose.yml index adadd36613..3611bf5276 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ version: '2' services: - ms: &ms + ms: image: metasploit build: context: . diff --git a/docker/Dockerfile b/docker/Dockerfile index 0e220d1290..8d68a1dcb4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,7 +1,7 @@ FROM ruby:2.3-alpine MAINTAINER Rapid7 -ARG BUNDLER_ARGS="--system --jobs=8" +ARG BUNDLER_ARGS="--jobs=8 --without development test coverage" ENV APP_HOME /usr/src/metasploit-framework/ WORKDIR $APP_HOME @@ -9,39 +9,36 @@ COPY Gemfile* m* Rakefile $APP_HOME COPY lib $APP_HOME/lib RUN apk update && \ - apk add \ - ruby-bigdecimal \ - ruby-bundler \ - ruby-io-console \ - autoconf \ - bison \ - subversion \ - git \ - sqlite \ - nmap \ - libxslt \ - postgresql \ - ncurses \ - && apk add --virtual .ruby-builddeps \ - build-base \ - ruby-dev \ - libffi-dev\ - openssl-dev \ - readline-dev \ - sqlite-dev \ - postgresql-dev \ - libpcap-dev \ - libxml2-dev \ - libxslt-dev \ - yaml-dev \ - zlib-dev \ - ncurses-dev \ - bison \ - autoconf \ - && echo "gem: --no-ri --no-rdoc" > /etc/gemrc \ - && bundle install $BUNDLER_ARGS \ - && apk del .ruby-builddeps \ - && rm -rf /var/cache/apk/* + apk add \ + sqlite-libs \ + nmap \ + # libxslt \ + postgresql-libs \ + # needed as long as metasploit-framework.gemspec contains a 'git ls' + git \ + ncurses \ + && apk add --virtual .ruby-builddeps \ + autoconf \ + bison \ + build-base \ + ruby-dev \ + libffi-dev\ + openssl-dev \ + readline-dev \ + sqlite-dev \ + postgresql-dev \ + libpcap-dev \ + libxml2-dev \ + libxslt-dev \ + yaml-dev \ + zlib-dev \ + ncurses-dev \ + bison \ + autoconf \ + && echo "gem: --no-ri --no-rdoc" > /etc/gemrc \ + && bundle install --system $BUNDLER_ARGS \ + && apk del .ruby-builddeps \ + && rm -rf /var/cache/apk/* ADD ./ $APP_HOME CMD ["./msfconsole", "-r", "docker/msfconsole.rc"] diff --git a/docker/docker-compose.development.override.yml b/docker/docker-compose.development.override.yml index 84d3de535b..f4ac60633a 100644 --- a/docker/docker-compose.development.override.yml +++ b/docker/docker-compose.development.override.yml @@ -1,7 +1,11 @@ version: '2' services: - ms: &ms + ms: + build: + args: + BUNDLER_ARGS: --jobs=8 + image: metasploit:dev environment: DATABASE_URL: postgres://postgres@db:5432/msf_dev From dd9266026277df39500d22a6d49a369f3ef96a7b Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Sat, 22 Apr 2017 02:13:20 +0200 Subject: [PATCH 2/3] remove comment --- docker/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 8d68a1dcb4..c1e98a592f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -12,7 +12,6 @@ RUN apk update && \ apk add \ sqlite-libs \ nmap \ - # libxslt \ postgresql-libs \ # needed as long as metasploit-framework.gemspec contains a 'git ls' git \ From e0fc7229bfec47490edb2888135bb55416dca7be Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Sat, 22 Apr 2017 02:33:33 +0200 Subject: [PATCH 3/3] try to fix travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e6a9560d71..5fb2123829 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ matrix: fast_finish: true include: - rvm: ruby-head - env: CMD=docker-compose -f $TRAVIS_BUILD_DIR/docker-compose.yml build + env: CMD="docker-compose -f $TRAVIS_BUILD_DIR/docker-compose.yml build" before_install: - "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc" - rake --version