Add readme; build/release script
This commit is contained in:
parent
067866af99
commit
70932f1ad9
|
@ -9,8 +9,9 @@ ENV EMBARK_VERSION=3.1.5 \
|
|||
|
||||
# IPFS: 5001 8080
|
||||
# Go Ethereum: 30303/tcp 30301/udp 8545
|
||||
# Embark: 8000
|
||||
EXPOSE 5001 8080 30303/tcp 30301/udp 8545 8000
|
||||
# Embark: 8000 8546 8545
|
||||
# Swarm: 8500
|
||||
EXPOSE 5001 8080 30303/tcp 30301/udp 8545 8546 8000 8500
|
||||
|
||||
RUN adduser --disabled-password --shell /bin/bash --gecos "" embark \
|
||||
# Install geth
|
||||
|
|
31
README.md
31
README.md
|
@ -1 +1,30 @@
|
|||
# embark-docker
|
||||
# Embark for Docker
|
||||
|
||||
## Updating versions
|
||||
|
||||
* Open `Dockerfile`
|
||||
* On the `ENV` directive, update necessary versions.
|
||||
|
||||
An exception to this is the NodeJS version, which needs to be updated in the `FROM` directive instead.
|
||||
|
||||
## Building
|
||||
|
||||
Building requires Docker to be installed on your local machine. To build, run:
|
||||
|
||||
```
|
||||
$ script/build
|
||||
```
|
||||
|
||||
## Releasing
|
||||
|
||||
Releasing requires that you're authenticated to Docker Hub. To do so, run:
|
||||
|
||||
```
|
||||
$ docker login
|
||||
```
|
||||
|
||||
After, or if you're already authenticated, run:
|
||||
|
||||
```
|
||||
$ script/build --release
|
||||
```
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'json'
|
||||
require 'net/http'
|
||||
require 'rubygems'
|
||||
|
||||
class CLI
|
||||
def run
|
||||
puts 'Building latest' if latest?
|
||||
puts "Tags: #{ tags_for_embark_version.join(', ') }"
|
||||
|
||||
command = ['docker', 'build', '.']
|
||||
tags_for_embark_version.each { |tag| command << "-t=statusim/embark:#{tag}" }
|
||||
|
||||
system(command.join(' '))
|
||||
|
||||
push_to_registry if ARGV.include?('--release')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def push_to_registry
|
||||
tags_for_embark_version.each do |tag|
|
||||
command = ['docker', 'push', "statusim/embark:#{tag}"]
|
||||
system(command.join(' '))
|
||||
end
|
||||
end
|
||||
|
||||
def embark_versions
|
||||
embark_versions ||= begin
|
||||
package_info['time'].keys.map do |v|
|
||||
Gem::Version.new(v) rescue nil
|
||||
end.compact.select { |v| v < Gem::Version.new('7.0.0') }
|
||||
end
|
||||
end
|
||||
|
||||
def package_info
|
||||
package_info ||= begin
|
||||
json = Net::HTTP.get('registry.npmjs.org', '/embark')
|
||||
JSON.parse(json)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def embark_version
|
||||
embark_version ||= begin
|
||||
dockerfile_path = File.expand_path('../../Dockerfile', __FILE__)
|
||||
dockerfile = File.open(dockerfile_path, 'r').read
|
||||
Gem::Version.new(dockerfile.match(/EMBARK_VERSION=([0-9.]*)/)[1])
|
||||
end
|
||||
end
|
||||
|
||||
def latest?
|
||||
package_info['dist-tags']['latest'] == embark_version.to_s
|
||||
end
|
||||
|
||||
def tags_for_embark_version
|
||||
tags = []
|
||||
tags << 'latest' if latest?
|
||||
tags << embark_version
|
||||
|
||||
# Version being X.Y.Z, figure out if we're the largest X.Y
|
||||
same_minor_versions = embark_versions.select { |ev| ev.segments[0..1] == embark_version.segments[0..1] }.sort
|
||||
tags << embark_version.segments[0..1].join('.') if embark_version == same_minor_versions.last
|
||||
|
||||
# Version being X.Y.Z, figure out if we're the latest X
|
||||
same_major_versions = embark_versions.select { |ev| ev.segments[0] == embark_version.segments[0] }.sort
|
||||
tags << embark_version.segments[0].to_s if embark_version == same_major_versions.last
|
||||
|
||||
tags
|
||||
end
|
||||
end
|
||||
|
||||
CLI.new.run
|
Loading…
Reference in New Issue