Skip to content

Commit bc86aa8

Browse files
committed
add by qiankunli
0 parents  commit bc86aa8

File tree

907 files changed

+125452
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

907 files changed

+125452
-0
lines changed

Dockerfile

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# using VirtualBox Guest Additions & FIG
2+
3+
FROM boot2docker/boot2docker
4+
5+
# Set this to your Virtual Box Version
6+
ENV VBOXVER 4.3.14
7+
# This is the name of Virtual Box Share to Automount
8+
ENV VBOXSHARENAME home
9+
# This is the path in the boot2docker guest where the share will mount
10+
ENV VBOXSHAREGUESTPATH /home/docker/code
11+
12+
# config your http_proxy
13+
14+
RUN apt-get install p7zip-full
15+
16+
RUN mkdir -p /vboxguest && \
17+
cd /vboxguest && \
18+
curl -L -o vboxguest.iso http://download.virtualbox.org/virtualbox/$VBOXVER/VBoxGuestAdditions_$VBOXVER.iso && \
19+
7z x vboxguest.iso -ir'!VBoxLinuxAdditions.run' && \
20+
sh VBoxLinuxAdditions.run --noexec --target . && \
21+
mkdir x86 && cd x86 && tar xvjf ../VBoxGuestAdditions-x86.tar.bz2 && cd .. && \
22+
mkdir amd64 && cd amd64 && tar xvjf ../VBoxGuestAdditions-amd64.tar.bz2 && cd .. && \
23+
cd amd64/src/vboxguest-$VBOXVER && KERN_DIR=/linux-kernel/ make && cd ../../.. && \
24+
cp amd64/src/vboxguest-$VBOXVER/*.ko $ROOTFS/lib/modules/$KERNEL_VERSION-tinycore64 && \
25+
mkdir -p $ROOTFS/sbin && cp x86/lib/VBoxGuestAdditions/mount.vboxsf $ROOTFS/sbin/
26+
27+
RUN echo "" >> $ROOTFS/etc/motd; \
28+
echo " boot2docker with VirtualBox guest additions version $VBOXVER with Fig 0.5.2" >> $ROOTFS/etc/motd; \
29+
echo "" >> $ROOTFS/etc/motd
30+
31+
# make mount permanent @todo it works, but its ugly. where should this go?
32+
RUN echo '#!/bin/sh' >> $ROOTFS/etc/rc.d/vbox-guest-additions-permanent-mount; \
33+
echo 'sudo modprobe vboxsf && sudo mkdir $VBOXSHAREGUESTPATH && sudo mount -t vboxsf $VBOXSHARENAME $VBOXSHAREGUESTPATH' >> $ROOTFS/etc/rc.d/vbox-guest-additions-permanent-mount
34+
RUN chmod +x $ROOTFS/etc/rc.d/vbox-guest-additions-permanent-mount
35+
RUN echo '/etc/rc.d/vbox-guest-additions-permanent-mount' >> $ROOTFS/opt/bootsync.sh
36+
37+
# FIG install
38+
# RUN curl -L https://github.com/docker/fig/releases/download/0.5.2/linux > $ROOTFS/usr/local/bin/fig
39+
# RUN chmod +x $ROOTFS/usr/local/bin/fig
40+
41+
# Add TCZ Extensions
42+
RUN tczex="python python-distribute" &&\
43+
for dep in $tczex; do \
44+
echo "Download $TCL_REPO_BASE/tcz/$dep.tcz" &&\
45+
curl -L -o /tmp/$dep.tcz $TCL_REPO_BASE/tcz/$dep.tcz && \
46+
unsquashfs -f -d $ROOTFS /tmp/$dep.tcz && \
47+
rm -f /tmp/$dep.tcz;\
48+
done
49+
50+
# This is very hackish, and a smarter person would do better to not use this method
51+
# This has a high probability of breaking in the future as python and python-distribute tcz packages update!
52+
ADD python/site-packages/ $ROOTFS/usr/local/lib/python2.7/site-packages/
53+
ADD python/bin/ $ROOTFS/usr/local/bin/
54+
#RUN chmod +x $ROOTFS/usr/local/bin/*
55+
56+
# config timezone
57+
RUN sed -i "s#append loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10:LABEL=boot2docker-data base#append tz=CST-8 loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10:LABEL=boot2docker-data base#g" /isolinux/isolinux.cfg
58+
59+
RUN depmod -a -b $ROOTFS $KERNEL_VERSION-tinycore64
60+
RUN /make_iso.sh
61+
CMD ["cat", "boot2docker.iso"]

README.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Build boot2docker.iso with VirtualBox Guest Additions and Fig.sh
2+
3+
__Allows the mount of a VirtualBox Share into boot2docker__ which is useful for doing actual work. So from `boot2docker ssh` you can do things like:
4+
```bash
5+
# In your project directory (ie /home/docker/code/myproject)
6+
fig up
7+
```
8+
9+
This Dockerfile will download the latest boot2docker image (see ``FROM boot2docker/boot2docker``),
10+
adds VirtualBox Guest Additions for your running VirtualBox version and fig python packages.
11+
12+
*You don't have to use Fig.sh, but its available if you want it.*
13+
14+
## Build
15+
To build your modified `boot2docker.iso` you need to have a running version of docker. Clone this repo and build as normal:
16+
17+
I have included my original iso for those who are trying to accomplish this with out a tremendous amount of headache. However, you might need to modify the VirtualBox version and share directories in the Dockerfile to match your setup.
18+
```bash
19+
20+
# build the actual boot2docker.iso with virtual box guest additions
21+
docker build -t boot2docker-vbga-fig .
22+
23+
# run the image
24+
docker run --rm boot2docker-vbga-fig > boot2docker.iso
25+
```
26+
27+
## Install the new.iso
28+
Move the new iso you created in the *Build* step to the .boot2docker directory in you home:
29+
```bash
30+
31+
# use the new boot2docker.iso
32+
boot2docker stop
33+
mv ~/.boot2docker/boot2docker.iso ~/.boot2docker/boot2docker.iso.backup
34+
mv boot2docker.iso ~/.boot2docker/boot2docker.iso
35+
```
36+
37+
## Setup the share
38+
You can do this from the terminal or in the VirtualBox GUI. This is how you do it in a terminal:
39+
``` bash
40+
41+
VBoxManage sharedfolder add boot2docker-vm -name home -hostpath /home/docker/code
42+
boot2docker up
43+
boot2docker ssh "ls /home/docker/code" # to verify if it worked
44+
```

python/bin/easy_install

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/local/bin/python
2+
3+
# -*- coding: utf-8 -*-
4+
import re
5+
import sys
6+
7+
from setuptools.command.easy_install import main
8+
9+
if __name__ == '__main__':
10+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
11+
sys.exit(main())

python/bin/easy_install-2.7

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/local/bin/python
2+
3+
# -*- coding: utf-8 -*-
4+
import re
5+
import sys
6+
7+
from setuptools.command.easy_install import main
8+
9+
if __name__ == '__main__':
10+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
11+
sys.exit(main())

python/bin/fig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/local/bin/python
2+
# EASY-INSTALL-ENTRY-SCRIPT: 'fig==0.5.2','console_scripts','fig'
3+
__requires__ = 'fig==0.5.2'
4+
import sys
5+
from pkg_resources import load_entry_point
6+
7+
if __name__ == '__main__':
8+
sys.exit(
9+
load_entry_point('fig==0.5.2', 'console_scripts', 'fig')()
10+
)

python/bin/pip

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/local/bin/python
2+
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==1.5.6','console_scripts','pip'
3+
__requires__ = 'pip==1.5.6'
4+
import sys
5+
from pkg_resources import load_entry_point
6+
7+
if __name__ == '__main__':
8+
sys.exit(
9+
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
10+
)

python/bin/pip2

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/local/bin/python
2+
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==1.5.6','console_scripts','pip2'
3+
__requires__ = 'pip==1.5.6'
4+
import sys
5+
from pkg_resources import load_entry_point
6+
7+
if __name__ == '__main__':
8+
sys.exit(
9+
load_entry_point('pip==1.5.6', 'console_scripts', 'pip2')()
10+
)

python/bin/pip2.7

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/local/bin/python
2+
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==1.5.6','console_scripts','pip2.7'
3+
__requires__ = 'pip==1.5.6'
4+
import sys
5+
from pkg_resources import load_entry_point
6+
7+
if __name__ == '__main__':
8+
sys.exit(
9+
load_entry_point('pip==1.5.6', 'console_scripts', 'pip2.7')()
10+
)

python/bin/wsdump.py

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
#!/usr/local/bin/python
2+
3+
import argparse
4+
import code
5+
import sys
6+
import threading
7+
import websocket
8+
try:
9+
import readline
10+
except:
11+
pass
12+
13+
14+
OPCODE_DATA = (websocket.ABNF.OPCODE_TEXT, websocket.ABNF.OPCODE_BINARY)
15+
ENCODING = getattr(sys.stdin, "encoding", "").lower()
16+
17+
class VAction(argparse.Action):
18+
def __call__(self, parser, args, values, option_string=None):
19+
if values==None:
20+
values = "1"
21+
try:
22+
values = int(values)
23+
except ValueError:
24+
values = values.count("v")+1
25+
setattr(args, self.dest, values)
26+
27+
def parse_args():
28+
parser = argparse.ArgumentParser(description="WebSocket Simple Dump Tool")
29+
parser.add_argument("url", metavar="ws_url",
30+
help="websocket url. ex. ws://echo.websocket.org/")
31+
parser.add_argument("-v", "--verbose", default=0, nargs='?', action=VAction,
32+
dest="verbose",
33+
help="set verbose mode. If set to 1, show opcode. "
34+
"If set to 2, enable to trace websocket module")
35+
36+
return parser.parse_args()
37+
38+
39+
class InteractiveConsole(code.InteractiveConsole):
40+
def write(self, data):
41+
sys.stdout.write("\033[2K\033[E")
42+
# sys.stdout.write("\n")
43+
sys.stdout.write("\033[34m" + data + "\033[39m")
44+
sys.stdout.write("\n> ")
45+
sys.stdout.flush()
46+
47+
def raw_input(self, prompt):
48+
line = raw_input(prompt)
49+
if ENCODING and ENCODING != "utf-8" and not isinstance(line, unicode):
50+
line = line.decode(ENCODING).encode("utf-8")
51+
elif isinstance(line, unicode):
52+
line = encode("utf-8")
53+
54+
return line
55+
56+
57+
def main():
58+
args = parse_args()
59+
console = InteractiveConsole()
60+
if args.verbose > 1:
61+
websocket.enableTrace(True)
62+
ws = websocket.create_connection(args.url)
63+
print("Press Ctrl+C to quit")
64+
65+
def recv():
66+
frame = ws.recv_frame()
67+
if not frame:
68+
raise websocket.WebSocketException("Not a valid frame %s" % frame)
69+
elif frame.opcode in OPCODE_DATA:
70+
return (frame.opcode, frame.data)
71+
elif frame.opcode == websocket.ABNF.OPCODE_CLOSE:
72+
ws.send_close()
73+
return (frame.opcode, None)
74+
elif frame.opcode == websocket.ABNF.OPCODE_PING:
75+
ws.pong("Hi!")
76+
77+
return None, None
78+
79+
80+
def recv_ws():
81+
while True:
82+
opcode, data = recv()
83+
msg = None
84+
if not args.verbose and opcode in OPCODE_DATA:
85+
msg = "< %s" % data
86+
elif args.verbose:
87+
msg = "< %s: %s" % (websocket.ABNF.OPCODE_MAP.get(opcode), data)
88+
89+
if msg:
90+
console.write(msg)
91+
92+
thread = threading.Thread(target=recv_ws)
93+
thread.daemon = True
94+
thread.start()
95+
96+
while True:
97+
try:
98+
message = console.raw_input("> ")
99+
ws.send(message)
100+
except KeyboardInterrupt:
101+
return
102+
except EOFError:
103+
return
104+
105+
106+
if __name__ == "__main__":
107+
try:
108+
main()
109+
except Exception as e:
110+
print(e)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Metadata-Version: 1.1
2+
Name: PyYAML
3+
Version: 3.10
4+
Summary: YAML parser and emitter for Python
5+
Home-page: http://pyyaml.org/wiki/PyYAML
6+
Author: Kirill Simonov
7+
Author-email: [email protected]
8+
License: MIT
9+
Download-URL: http://pyyaml.org/download/pyyaml/PyYAML-3.10.tar.gz
10+
Description: YAML is a data serialization format designed for human readability
11+
and interaction with scripting languages. PyYAML is a YAML parser
12+
and emitter for Python.
13+
14+
PyYAML features a complete YAML 1.1 parser, Unicode support, pickle
15+
support, capable extension API, and sensible error messages. PyYAML
16+
supports standard YAML tags and provides Python-specific tags that
17+
allow to represent an arbitrary Python object.
18+
19+
PyYAML is applicable for a broad range of tasks from complex
20+
configuration files to object serialization and persistance.
21+
Platform: Any
22+
Classifier: Development Status :: 5 - Production/Stable
23+
Classifier: Intended Audience :: Developers
24+
Classifier: License :: OSI Approved :: MIT License
25+
Classifier: Operating System :: OS Independent
26+
Classifier: Programming Language :: Python
27+
Classifier: Programming Language :: Python :: 2
28+
Classifier: Programming Language :: Python :: 2.3
29+
Classifier: Programming Language :: Python :: 2.4
30+
Classifier: Programming Language :: Python :: 2.5
31+
Classifier: Programming Language :: Python :: 2.6
32+
Classifier: Programming Language :: Python :: 2.7
33+
Classifier: Programming Language :: Python :: 3
34+
Classifier: Programming Language :: Python :: 3.0
35+
Classifier: Programming Language :: Python :: 3.1
36+
Classifier: Programming Language :: Python :: 3.2
37+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
38+
Classifier: Topic :: Text Processing :: Markup
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
README
2+
setup.cfg
3+
ext/_yaml.c
4+
ext/_yaml.h
5+
ext/_yaml.pxd
6+
ext/_yaml.pyx
7+
lib/PyYAML.egg-info/PKG-INFO
8+
lib/PyYAML.egg-info/SOURCES.txt
9+
lib/PyYAML.egg-info/dependency_links.txt
10+
lib/PyYAML.egg-info/top_level.txt
11+
lib/yaml/__init__.py
12+
lib/yaml/composer.py
13+
lib/yaml/constructor.py
14+
lib/yaml/cyaml.py
15+
lib/yaml/dumper.py
16+
lib/yaml/emitter.py
17+
lib/yaml/error.py
18+
lib/yaml/events.py
19+
lib/yaml/loader.py
20+
lib/yaml/nodes.py
21+
lib/yaml/parser.py
22+
lib/yaml/reader.py
23+
lib/yaml/representer.py
24+
lib/yaml/resolver.py
25+
lib/yaml/scanner.py
26+
lib/yaml/serializer.py
27+
lib/yaml/tokens.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
../yaml/__init__.py
2+
../yaml/serializer.py
3+
../yaml/reader.py
4+
../yaml/composer.py
5+
../yaml/dumper.py
6+
../yaml/error.py
7+
../yaml/constructor.py
8+
../yaml/events.py
9+
../yaml/resolver.py
10+
../yaml/loader.py
11+
../yaml/cyaml.py
12+
../yaml/tokens.py
13+
../yaml/nodes.py
14+
../yaml/parser.py
15+
../yaml/representer.py
16+
../yaml/scanner.py
17+
../yaml/emitter.py
18+
../yaml/__init__.pyc
19+
../yaml/serializer.pyc
20+
../yaml/reader.pyc
21+
../yaml/composer.pyc
22+
../yaml/dumper.pyc
23+
../yaml/error.pyc
24+
../yaml/constructor.pyc
25+
../yaml/events.pyc
26+
../yaml/resolver.pyc
27+
../yaml/loader.pyc
28+
../yaml/cyaml.pyc
29+
../yaml/tokens.pyc
30+
../yaml/nodes.pyc
31+
../yaml/parser.pyc
32+
../yaml/representer.pyc
33+
../yaml/scanner.pyc
34+
../yaml/emitter.pyc
35+
./
36+
SOURCES.txt
37+
dependency_links.txt
38+
top_level.txt
39+
PKG-INFO
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
yaml
2+
_yaml

0 commit comments

Comments
 (0)