Skip to content

Commit ea6bbac

Browse files
committed
[feature] add habitat utility for infrastructure free packaging
1 parent eb29134 commit ea6bbac

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

habitat/default.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
listening_port=8080

habitat/plan.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
pkg_origin=gitgik
2+
pkg_name=django-api
3+
pkg_version=0.1.0
4+
pkg_maintainer="jeegiks@gmail.com"
5+
pkg_upstream_url="https://github.com/gitgik/django-rest-api.git"
6+
pkg_exports=([port]=listening_port)
7+
pkg_exposes=(port)
8+
pkg_build_deps=(core/virtualenv)
9+
pkg_deps=(core/python core/coreutils)
10+
pkg_licence=('MIT')
11+
pkg_interpreters=(bin/python3)
12+
13+
do_verify () {
14+
return 0
15+
}
16+
17+
do_clean() {
18+
return 0
19+
}
20+
21+
do_unpack() {
22+
# copy the contents of the source directory to the habitat cache path
23+
PROJECT_ROOT="${PLAN_CONTEXT}/.."
24+
25+
mkdir -p $pkg_prefix
26+
build_line "Copying project data to $pkg_prefix/"
27+
cp -r $PROJECT_ROOT/project $pkg_prefix/
28+
cp -r $PROJECT_ROOT/rest_api $pkg_prefix/
29+
cp -r $PROJECT_ROOT/*.py $pkg_prefix/
30+
cp -r $PROJECT_ROOT/requirements.txt $pkg_prefix/
31+
build_line "Copying .env file with preset variables..."
32+
}
33+
34+
do_build() {
35+
return 0
36+
}
37+
38+
do_install() {
39+
cd $pkg_prefix
40+
build_line "Creating virtual environment..."
41+
virtualenv venv
42+
source venv/bin/activate
43+
pip3 install -r requirements.txt
44+
build_line "Done installing requirements..."
45+
}

0 commit comments

Comments
 (0)