Skip to content

Commit

Permalink
#3 docker file start
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Aug 18, 2020
1 parent 780721e commit dae740c
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 5 deletions.
9 changes: 5 additions & 4 deletions bin/degit
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ STDOUT.sync = true
require 'slop'
require 'backtrace'
require_relative '../lib/degit/version'
require_relative '../lib/degit/deploy'

begin
begin
opts = Slop.parse(ARGV, strict: true, help: true) do |o|
o.banner = "Usage (#{Degit::VERSION}): degit [options] command [args]
Commands are:
run: Run the dashboard
node: Run the node
deploy: Make sure the server is ready to be part of DeGit network
Options are:"
o.bool '--help', 'Read this: https://github.com/yegor256/degit' do
puts o
Expand All @@ -48,9 +49,9 @@ Options are:"
log = opts[:verbose] ? Loog::VERBOSE : Loog::REGULAR
case opts.arguments[0]
when 'run'
log.info('Not implemented yet')
when 'node'
log.info('Not yet')
Degit::Dashboard.new(log: log).go
when 'deploy'
Degit::Deploy.new(log: log).go
else
raise "Command #{opts.arguments[0]} is not supported"
end
Expand Down
39 changes: 39 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright (c) 2020 Yegor Bugayenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software'), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

# This image is making the server fully ready to work as a node in
# DeGit network.

FROM ubuntu:18.04
MAINTAINER Yegor Bugayenko <[email protected]>
LABEL Description="This is the default image for DeGit" Vendor="DeGit" Version="1.0"
WORKDIR /tmp

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y
RUN apt-get install -y openssh-server git
RUN mkdir -p /var/run/sshd

RUN mkdir -p /usr/local/bin/degit \
&& mv /usr/bin/git /usr/local/bin/degit/git \
&& for i in git-receive-pack git-upload-archive git-upload-pack; do ln -s /usr/local/bin/degit/git "/usr/local/bin/degit/${i}"; done

ENTRYPOINT ["/usr/sbin/sshd", "-D", "-o", "ListenAddress=0.0.0.0"]
38 changes: 38 additions & 0 deletions lib/degit/dashboard.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# frozen_string_literal: true

# Copyright (c) 2020 Yegor Bugayenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software'), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

require 'loog'

# Dashboard.
# Author:: Yegor Bugayenko ([email protected])
# Copyright:: Copyright (c) 2020 Yegor Bugayenko
# License:: MIT
class Degit::Dashboard
# Current version of the library.
def initialize(log: Loog::NULL)
@log = log
end

def go
@log.info('To be continued...')
end
end
38 changes: 38 additions & 0 deletions lib/degit/deploy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# frozen_string_literal: true

# Copyright (c) 2020 Yegor Bugayenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software'), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

require 'loog'

# Deploy.
# Author:: Yegor Bugayenko ([email protected])
# Copyright:: Copyright (c) 2020 Yegor Bugayenko
# License:: MIT
class Degit::Deploy
# Current version of the library.
def initialize(log: Loog::NULL)
@log = log
end

def go
@log.info('To be continued...')
end
end
2 changes: 1 addition & 1 deletion lib/degit/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# Author:: Yegor Bugayenko ([email protected])
# Copyright:: Copyright (c) 2020 Yegor Bugayenko
# License:: MIT
class Degit
module Degit
# Current version of the library.
VERSION = '0.0.0'
end

0 comments on commit dae740c

Please sign in to comment.