Dan K
2019-08-06 308b57b7a031c2dc7575e87eefda67c1852c6f06
commit | author | age
411e81 1 // Copyright (c) 2016-present Sonatype, Inc.
DK 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 <%=
16 require 'json'
17
18 raise RuntimeError, 'environment variable DOCKER_TYPE is required' if ENV['DOCKER_TYPE'].nil? || ENV['DOCKER_TYPE'].empty?
19 raise RuntimeError, 'environment variable SONATYPE_DIR is required' if ENV['SONATYPE_DIR'].nil? || ENV['SONATYPE_DIR'].empty?
20 raise RuntimeError, 'environment variable NEXUS_HOME is required' if ENV['NEXUS_HOME'].nil? || ENV['NEXUS_HOME'].empty?
21 raise RuntimeError, 'environment variable NEXUS_DATA is required' if ENV['NEXUS_DATA'].nil? || ENV['NEXUS_DATA'].empty?
22
23 {
24   :run_list => [ "recipe[nexus_repository_manager::#{ENV['DOCKER_TYPE']}]" ],
25   :java => {
26     :install_flavor => 'openjdk',
27     :accept_license_agreement => true
28   },
29   :nexus_repository_manager => {
30     :version => ENV['NEXUS_VERSION'],
31     :nexus_download_url => ENV['NEXUS_DOWNLOAD_URL'],
32     :nexus_download_sha256 => ENV['NEXUS_DOWNLOAD_SHA256_HASH'],
33     :sonatype => {
34       :path => ENV['SONATYPE_DIR'],
35     },
36     :sonatype_work => {
37       :path => ENV['SONATYPE_DIR'] + '/sonatype-work'
38     },
39     :nexus_home => {
40       :path => ENV['SONATYPE_DIR'] + '/nexus'
41     },
42     :nexus_data => {
43       :path => ENV['NEXUS_DATA']
44     },
45     :properties => {
46       # Set the context_path to the NEXUS_CONTEXT environment variable
47       # that may be passed into the docker run command.
48       :context_path => "/${NEXUS_CONTEXT}"
49     }
50   }
51 }.to_json
52 %>