[asterisk-dev] Asterisk Docker Containers: Phase 1

Leif Madsen leif.madsen at avoxi.com
Thu Nov 19 16:09:49 CST 2015


On Thu, Nov 19, 2015 at 10:14 AM, Matthew Jordan <mjordan at digium.com> wrote:

>
> <snip>
>
>
>> On Mon, Nov 16, 2015 at 4:31 PM, Steve Edwards <asterisk.org at sedwards.com
>> > wrote:
>>
>>> On Mon, Nov 16, 2015 at 4:31 PM, Steve Edwards <
>>>> asterisk.org at sedwards.com> wrote:
>>>> >
>>>> > On Mon, 16 Nov 2015, Leif Madsen wrote:
>>>> >
>>>> >> I wrote up a lengthy blog post that likely borders on ranting:
>>>> >>
>>>> >>
>>>> http://blog.leifmadsen.com/blog/2015/11/10/asterisk-docker-container-phase-1/
>>>> >
>>>> >
>>>>
>>>
> Great blog post :-)
>
> Would it be appropriate to summarize the current state of things as "we
> need a spec file for Asterisk"?
>
>
Yes, that would be fair. Good thing Alan Graham pointed me at a project
that will build one for us pretty simply from the source directory. I need
to work on another blog post, but basically I have sorted out the main
sticking points, and it doesn't require the Fedora .spec file at all. I'm
trying to work with tools that will generate the package, simply for the
purposes of getting it into the Docker container image (it's probably not
appropriate for further distribution as a "de facto" image, but that's
another problem to solve at another time).


>
> Just to address Steve's point:
>
> Packages aren't going anywhere. I do think we can all agree that the state
> of Asterisk packaging could use some improvement, but that's a separate
> discussion.
>
> Docker is another way to deploy Asterisk, that may or may not use
> packages. (And as Chad pointed out, we're using Docker here at Digium for
> that purpose.) As Leif mentioned in his blog post, there's definitely
> benefits to using packages with Docker, as it reduces the size of the
> Docker images. If the goal is to have a universally accepted Docker file
> for the Asterisk project, then it probably make sense to use packages; that
> would necessitate either having dependable packages for a variety of
> distros, or include a .spec file with the project.
>
> Leif: Does that sound correct?
>
>
Yes that does sound correct, and you're right that *my* goal is to provide
a Dockerfile that can be shipped with the Asterisk source. In my adventures
earlier this week, I found a project that uses Docker to package up the
Asterisk source that you're running from (which means you can generate a
package for the source you've modified, if that's your thing), and then use
the resulting package as the basis of your Asterisk container image you're
going to build.

This is VERY useful when you start wanting to avoid having to modify spec
files for every change you make, or every version of Asterisk, meaning that
a good chunk, if not the entire process, could be automated. This is good
news, because then the Asterisk project could actually use these files to
generate "official" Docker container images. We're not that far yet, but I
don't think we're far off.

Hopefully tomorrow I can spend an hour or so working on a phase 2 blog
post, and then start learning how to submit some files back to the project
:)

Here is a preview of the workflow (copy / pasta of the README.md I created):

# Building Asterisk into a Docker Container Image

Build the package container image. This uses FPM so no `spec` files and
such are
necessary.
```
docker build --pull -f contrib/docker/Dockerfile.packager -t asterisk-build
.
```

Build the Asterisk RPM from the resulting container image.
```
docker run -ti -v $(pwd):/application:ro -v $(pwd)/out:/build -w
/application asterisk-build /application/contrib/docker/make-package.sh
13.6.0
```

Now create your own Asterisk container image from the resulting RPM.
```
docker build --rm -t madsen/asterisk:13.6.0-1 -f
contrib/docker/Dockerfile.asterisk .
```


--
Leif Madsen
Director of Engineering, Product Development
http://avoxi.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20151119/55fc799e/attachment.html>


More information about the asterisk-dev mailing list