Skip to content

Commit f1266a9

Browse files
committed
Initial import
0 parents  commit f1266a9

File tree

8 files changed

+164
-0
lines changed

8 files changed

+164
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.bob*
2+
/dev/
3+
/work/
4+
user.yaml

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "layers/basement"]
2+
path = layers/basement
3+
url = https://github.com/BobBuildTool/basement.git

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Bob containers example
2+
3+
This repository uses the [basement](https://github.com/BobBuildTool/basement)
4+
recipes to build a lighttpd container.
5+
6+
# Prerequisites
7+
8+
* A x86_64 system with the regular development tools installed (gcc, make,
9+
perl, ...)
10+
* Bleeding edge Bob Build Tool (https://github.com/BobBuildTool/bob)
11+
* Patience
12+
13+
# How to build
14+
15+
Clone the recipes and build them with Bob:
16+
17+
$ git clone https://github.com/BobBuildTool/bob-example-containers.git \
18+
--recurse-submodules
19+
$ bob build containers::lighttpd
20+
21+
This recipe builds a minimal container image that has solely lighttpd and the
22+
required dependencies installed.
23+
24+
# How to use
25+
26+
To use it you have to import it in docker:
27+
28+
$ tar -C $(bob query-path -f '{dist}' --release containers::lighttpd) -c . \
29+
| docker import - lighttpd
30+
31+
Now you can serve any host directory with the lighttpd in the image:
32+
33+
$ docker run -it --rm -p 8080:80 -v <your-html-dir>:/srv/www lighttpd \
34+
/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf \
35+
-m /usr/lib/lighttpd
36+
37+
This will expose the lighttpd at port 8080 on your host.

config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
bobMinimumVersion: "0.15"
2+
layers:
3+
- basement

default.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include:
2+
- user

layers/basement

Submodule basement added at 77d7711

recipes/containers/lighttpd.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
root: True
2+
3+
depends:
4+
# define host environment
5+
-
6+
name: devel::sandbox
7+
use: [sandbox]
8+
forward: True
9+
-
10+
name: devel::sandbox-toolchain
11+
use: [environment, tools]
12+
forward: True
13+
14+
# some required host tools
15+
-
16+
name: devel::pkg-config
17+
use: [tools]
18+
forward: True
19+
20+
# target toolchain
21+
-
22+
name: devel::cross-toolchain-x86_64-linux-gnu
23+
use: [environment, tools]
24+
forward: True
25+
26+
- libs::libc-tgt
27+
- net::lighttpd
28+
29+
30+
buildScript: |
31+
# start from scratch
32+
rm -rf *
33+
34+
# copy rootfs
35+
for dep in "${BOB_DEP_PATHS[@]}" ; do
36+
cp -an ${dep}/* .
37+
done
38+
39+
# some setup is needed
40+
mkdir -p run var var/log
41+
install -d -m 1777 var/tmp
42+
install -d -m 0777 var/log/lighttpd
43+
ln -sT ../run var/run
44+
45+
# install our version of lighttpd.conf
46+
install -m 644 $<<lighttpd/lighttpd.conf>> etc/lighttpd/lighttpd.conf
47+
48+
# need a lighttpd user and group
49+
cat >etc/passwd <<EOF
50+
root:x:0:0:root:/root:/bin/bash
51+
lighttpd:x:33:33:www-data:/var/www:/usr/sbin/nologin
52+
EOF
53+
cat >etc/group <<EOF
54+
root:x:0:
55+
lighttpd:x:33:
56+
EOF
57+
58+
packageScript: |
59+
cp -a $1/* .
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
## /etc/lighttpd/lighttpd.conf
2+
3+
var.log_root = "/var/log/lighttpd"
4+
var.server_root = "/srv/www"
5+
var.state_dir = "/var/run"
6+
var.home_dir = "/var/lib/lighttpd"
7+
var.conf_dir = "/etc/lighttpd"
8+
9+
server.modules = (
10+
"mod_access"
11+
)
12+
13+
server.username = "lighttpd"
14+
server.groupname = "lighttpd"
15+
server.document-root = server_root
16+
server.pid-file = state_dir + "/lighttpd.pid"
17+
18+
server.errorlog = log_root + "/error.log"
19+
20+
##
21+
## Access log config
22+
##
23+
include "conf.d/access_log.conf"
24+
25+
##
26+
## The debug options are moved into their own file.
27+
## see conf.d/debug.conf for various options for request debugging.
28+
##
29+
include "conf.d/debug.conf"
30+
31+
server.event-handler = "linux-sysepoll"
32+
server.network-backend = "sendfile"
33+
server.max-fds = 2048
34+
35+
server.stat-cache-engine = "simple"
36+
server.max-connections = 1024
37+
38+
index-file.names += (
39+
"index.xhtml", "index.html", "index.htm", "default.htm"
40+
)
41+
url.access-deny = ( "~", ".inc" )
42+
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" )
43+
44+
##
45+
## mimetype mapping
46+
##
47+
include "conf.d/mime.conf"
48+
49+
##
50+
## directory listing configuration
51+
##
52+
include "conf.d/dirlisting.conf"
53+
54+
server.follow-symlink = "enable"
55+
server.upload-dirs = ( "/var/tmp" )

0 commit comments

Comments
 (0)