File tree 6 files changed +55
-13
lines changed
6 files changed +55
-13
lines changed Original file line number Diff line number Diff line change
1
+ FROM ubuntu:14.04
2
+ MAINTAINER Dongweiming "ciici123@gmail.com"
3
+
4
+ ENV DEBIAN_FRONTEND noninteractive
5
+ ENV CODE_ENV "unset"
6
+
7
+ RUN echo "deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse" > /etc/apt/sources.list
8
+ RUN echo "deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse" >> /etc/apt/sources.list
9
+ RUN echo "deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse" >> /etc/apt/sources.list
10
+ RUN echo "deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse" >> /etc/apt/sources.list
11
+ RUN echo "deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse" >> /etc/apt/sources.list
12
+ RUN echo "deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse" >> /etc/apt/sources.list
13
+ RUN echo "deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse" >> /etc/apt/sources.list
14
+ RUN echo "deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse" >> /etc/apt/sources.list
15
+ RUN echo "deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse" >> /etc/apt/sources.list
16
+ RUN echo "deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse" >> /etc/apt/sources.list
17
+ RUN apt-get update
18
+
19
+ RUN apt-get install curl python -yq
20
+ RUN curl -O https://raw.githubusercontent.com/dongweiming/code/master/scripts/install_code.sh
21
+ RUN /bin/bash install_code.sh
22
+ RUN rm -rf install_code.sh
Original file line number Diff line number Diff line change @@ -12,6 +12,28 @@ Dependency
12
12
- Python 2.7+
13
13
- pip >= 1.4.1
14
14
15
+ Docker Installation
16
+ -------------------
17
+
18
+ You can use [ code] ( https://registry.hub.docker.com/u/dongweiming/code/ )
19
+
20
+ ```
21
+ docker pull dongweiming/code
22
+ ```
23
+
24
+ or just build locally(recommended):
25
+
26
+ ```
27
+ cd code
28
+ docker build -t code .
29
+ ```
30
+
31
+ And launch a bash shell inside the container:
32
+
33
+ ```
34
+ docker run -t -i code /bin/bash
35
+ ```
36
+
15
37
Quick Installation
16
38
------------------
17
39
Currently supports the following systems:
Original file line number Diff line number Diff line change 1
- MySQL-python == 1.2.4
1
+ -e git+https://github.com/qingfeng/MySQLdb1@ MySQL-python- 1.2.4#egg=MySQL-python
2
2
Mako == 0.9.0
3
3
docutils == 0.9.1
4
4
gunicorn == 18.0
Original file line number Diff line number Diff line change @@ -19,21 +19,23 @@ install_libmemcached() {
19
19
check_virtualenv () {
20
20
which virtualenv > /dev/null 2>&1
21
21
if [ $? != 0 ]; then
22
- echo " Install virtualenv..."
23
- sudo pip install virtualenv
22
+ echo " Install virtualenv..."
23
+ sudo pip install virtualenv
24
24
fi
25
+ virtualenv venv
26
+ . venv/bin/activate
25
27
}
26
28
27
29
setup_database () {
28
30
read -p " Please input Mysql User(default is root):" user
29
31
if [ " ${user} " = " " ]; then
30
- user=" root"
32
+ user=" root"
31
33
fi
32
34
read -p " Please input Mysql ${user} 's password(default is ''):" passwd
33
35
echo " drop database if exists valentine" | mysql --user=${user} --password=${passwd}
34
36
echo " create database valentine" | mysql --user=${user} --password=${passwd}
35
- if [ $? -ne 0 ]; then
36
- exit 1
37
+ if [b $? -ne 0 ]; then
38
+ exit 1
37
39
fi
38
40
(echo " use valentine" ; cat vilya/databases/schema.sql) | mysql --user=${user} --password=${passwd}
39
41
}
@@ -43,14 +45,9 @@ install_code() {
43
45
cd code
44
46
echo " Setup database..."
45
47
setup_database
46
- check_virtualenv
47
- virtualenv venv
48
- . venv/bin/activate
48
+ test " $CODE_ENV " ! = " unset" && check_virtualenv
49
49
pip install cython # should install first
50
50
pip install -U setuptools # python-libmemcached require updated setuptools
51
- if [ -f /etc/arch-release ] ; then
52
- pip install " distribute==0.6.29" # Fixed install MySQL-python on archlinux for #14
53
- fi
54
51
pip install -r requirements.txt
55
52
}
56
53
Original file line number Diff line number Diff line change 3
3
# Check Python version > 2.7
4
4
test ` python -c ' import sys; print sys.version_info < (2, 7)' ` = " True" && echo ' CODE requires Python 2.7.' && exit 1
5
5
6
- url=' https://raw.github .com/douban/code/master/scripts'
6
+ url=' https://raw.githubusercontent .com/douban/code/master/scripts'
7
7
8
8
if [ -f /etc/fedora-release ] ; then
9
9
file=" $url /fedora.sh"
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ sudo apt-get install build-essential g++ git python-pip python-virtualenv python
8
8
9
9
echo " Install mysql..."
10
10
sudo apt-get install mysql-client mysql-server libmysqlclient-dev -yq
11
+ /etc/init.d/mysql restart
11
12
12
13
echo " Setup memcached port to 11311..."
13
14
sudo sed -i " s/11211/11311/g" /etc/memcached.conf
You can’t perform that action at this time.
0 commit comments