Add initial support to build Docker images
[asterisk/asterisk.git] / contrib / docker / README.md
1 # Building Asterisk into a Docker Container Image
2 The following set of steps should leave you with a Docker container that
3 is relatively small, built from your local checked out source, and even
4 provides you with a nice little RPM too!
5
6 ## Build the package container image
7 Build the package container image. This uses FPM[1] so no `spec` files and
8 such are necessary.
9 ```
10 docker build --pull -f contrib/docker/Dockerfile.packager -t asterisk-build .
11 ```
12
13 ## Build your Asterisk RPM from source
14 Build the Asterisk RPM from the resulting container image.
15 ```
16 docker run -ti \
17     -v $(pwd):/application:ro \
18     -v $(pwd)/out:/build \
19     -w /application asterisk-build \
20     /application/contrib/docker/make-package.sh 13.6.0
21 ```
22 > **NOTE**: If you need to build this on a system that has SElinux enabled
23 > you'll need to use the following command instead:
24 > ```
25 > docker run -ti \
26 >     -v $(pwd):/application:Z \
27 >     -v $(pwd)/out:/build:Z \
28 >     -w /application asterisk-build \
29 >     /application/contrib/docker/make-package.sh 13.6.0
30 > ```
31
32 ## Create your Asterisk container image
33 Now create your own Asterisk container image from the resulting RPM.
34 ```
35 docker build --rm -t madsen/asterisk:13.6.0-1 -f contrib/docker/Dockerfile.asterisk .
36 ```
37
38 # References
39 [1] https://github.com/jordansissel/fpm