Skip to content

Commit 9fe11d3

Browse files
committed
Initial commit
0 parents  commit 9fe11d3

10 files changed

+660
-0
lines changed

Dockerfile.base

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM httpd
2+
MAINTAINER Antoine Motet "[email protected]"
3+
4+
RUN apt-get update \
5+
&& apt-get install --no-install-recommends --no-install-suggests -y \
6+
git \
7+
liblua5.1-0 \
8+
openssl \
9+
zlib1g \
10+
&& rm -r /var/cache/apt/ \
11+
&& rm -rf /var/lib/apt/lists/*

Dockerfile.build

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM httpd-cgit-base
2+
MAINTAINER Antoine Motet "[email protected]"
3+
4+
RUN apt-get update && apt-get install -y \
5+
build-essential \
6+
curl \
7+
liblua5.1-0-dev \
8+
libssl-dev \
9+
zlib1g-dev \
10+
&& rm -r /var/cache/apt/
11+
12+
WORKDIR /usr/src/cgit/
13+
14+
ADD scripts/build-cgit.sh .
15+
16+
RUN sh build-cgit.sh

Dockerfile.run

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM httpd-cgit-base
2+
3+
WORKDIR /usr/local/apache2/cgi-bin/
4+
ADD build-output/cgit ./cgit.cgi
5+
6+
WORKDIR /usr/local/apache2/htdocs
7+
ADD build-output/cgit.css .
8+
ADD build-output/cgit.png .
9+
ADD build-output/robots.txt .
10+
ADD build-output/favicon.ico .
11+
12+
WORKDIR /usr/local/apache2/conf
13+
ADD config/httpd.conf .
14+
15+
WORKDIR /etc/
16+
ADD config/cgitrc .

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2016 Antoine Motet
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# docker-httpd-cgit
2+
3+
A Docker image for [cgit](https://git.zx2c4.com/cgit/) with Apache
4+
httpd.
5+
6+
Build it with `./build.sh`. The created image name is `http-cgit`.
7+
8+
`cgit` is compiled inside a temporary build image and then copied into
9+
a ligther production image. It is probably overkill since we can also
10+
do everything in the same image and uninstall build dependencies after
11+
the complation, but it's fun to see this little hack working :-)
12+
13+
You have to setup a volume to fill the directory `/var/cgit-repos/`
14+
with the list of the bare Git repositories to be served. It's easy to
15+
do with a `docker-compose.yml`:
16+
17+
```yml
18+
version: '2'
19+
services:
20+
21+
httpd-cgit:
22+
image: httpd-cgit
23+
volumes:
24+
- ./repos-on-the-host:/var/cgit-repos
25+
ports:
26+
- "3000:80"
27+
```

build.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh -ex
2+
3+
docker build -f Dockerfile.base -t httpd-cgit-base .
4+
docker build -f Dockerfile.build -t httpd-cgit-build .
5+
6+
id=$(docker create httpd-cgit-build)
7+
8+
build_path=/usr/src/cgit/cgit
9+
10+
mkdir build-output
11+
cd build-output
12+
docker cp $id:$build_path/cgit .
13+
docker cp $id:$build_path/cgit.css .
14+
docker cp $id:$build_path/cgit.png .
15+
docker cp $id:$build_path/robots.txt .
16+
docker cp $id:$build_path/favicon.ico .
17+
cd ..
18+
19+
docker rm -v $id
20+
docker build -f Dockerfile.run -t httpd-cgit .
21+
rm -rf build-output

config/cgitrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
enable-commit-graph=1
3+
4+
css=/static/cgit.css
5+
logo=/static/cgit.png
6+
7+
scan-path=/var/cgit-repos

0 commit comments

Comments
 (0)