diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0de32f2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +spec/ +.git +.gitignore +.travis.yml +Gemfile +Gemfile.lock \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..68feb7d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +Gemfile.lock \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9e32525 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +sudo: required + +services: +- docker + +install: bundle + +script: bundle exec rspec \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d2347ef..99d164e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,10 +4,11 @@ MAINTAINER kzhu ENV PRESTO_VERSION=0.181 ENV PRESTO_HOME=/opt/presto -ADD https://repo1.maven.org/maven2/com/facebook/presto/presto-server/${PRESTO_VERSION}/presto-server-${PRESTO_VERSION}.tar.gz /opt - -RUN ln -s /opt/presto-server-${PRESTO_VERSION} ${PRESTO_HOME} && \ - mkdir -p ${PRESTO_HOME}/data +RUN curl -L https://repo1.maven.org/maven2/com/facebook/presto/presto-server/${PRESTO_VERSION}/presto-server-${PRESTO_VERSION}.tar.gz -o /tmp/presto-server.tgz && \ + tar -xzf /tmp/presto-server.tgz -C /opt && \ + ln -s /opt/presto-server-${PRESTO_VERSION} ${PRESTO_HOME} && \ + mkdir -p ${PRESTO_HOME}/data && \ + rm -f /tmp/presto-server.tgz COPY etc ${PRESTO_HOME}/etc EXPOSE 8080 @@ -16,4 +17,6 @@ VOLUME ["${PRESTO_HOME}/etc", "${PRESTO_HOME}/data"] WORKDIR ${PRESTO_HOME} -CMD ["./bin/launcher", "run"] +ENTRYPOINT ["./bin/launcher"] + +CMD ["run"] diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..07fd459 --- /dev/null +++ b/Gemfile @@ -0,0 +1,7 @@ +source 'https://rubygems.org' + +group :integration do + gem 'serverspec' + gem 'docker' + gem 'docker-api', :require => 'docker' +end \ No newline at end of file diff --git a/spec/prestodb_spec.rb b/spec/prestodb_spec.rb new file mode 100644 index 0000000..e3a2c2a --- /dev/null +++ b/spec/prestodb_spec.rb @@ -0,0 +1,29 @@ +require 'serverspec' +require 'docker' + +describe 'shawnzhu/prestodb' do + before(:all) do + image = Docker::Image.build_from_dir('.') + + set :backend, :docker + set :docker_image, image.id + end + + describe file('/opt/presto-server-0.181') do + it { should be_directory } + end + + describe file('/opt/presto') do + it { should be_symlink } + end + + describe file('/opt/presto/data') do + it { should be_directory } + end + + describe command('ls /opt/presto/etc/') do + %w{catalog config.properties jvm.config node.properties}.each do |file| + its(:stdout) { should contain(file) } + end + end +end \ No newline at end of file