Build an Icecast streaming server on Heroku using Docker

Docker × Heroku

Instructions

Create your Docker image

Create a new directory for your project:

mkdir your-project-name

Navigate to the directory and initialize Git repository by running:

cd your-project-name
git init

Create a new file named Dockerfile (no extension) with following content:

FROM centos:7
MAINTAINER "John Smith" <your@email.com>
RUN yum -y update && yum clean all
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
RUN yum -y install icecast
RUN sed -ri "s/<bind-address>127.0.0.1<\/bind-address>/<bind-address>0.0.0.0<\/bind-address>/g" /etc/icecast.xml
CMD sed -ri "s/<port>8000<\/port>/<port>$PORT<\/port>/g" /etc/icecast.xml && /bin/icecast -c /etc/icecast.xml

Build & Deploy your Docker image

Install the container-registry plugin by running:

$ heroku plugins:install heroku-container-registry

Log in to the Heroku container registry:

$ heroku container:login

Create a Heroku app:

$ heroku create

Build the image and push to the Heroku container registry:

$ heroku container:push web

Open the app in your browser:

heroku open

Done! You have a powerful Icecast server on Heroku now.

Next

Try to use your own icecast.xml in your container.

Add the ADD command to Dockerfile

e.g.

RUN yum -y install icecast
ADD ./icecast-custom.xml /etc/icecast.xml

Final project files:

$ tree
.
├── Dockerfile
└── icecast-custom.xml

Here is my Git for your reference. https://github.com/shikendon/icecast-heroku-example

Listening

You need to concat the listening URL yourself instead of using the m3u file on Icecast page.

e.g. http://myherokuurl.herokuapp.com/stream

Document References

library/centos — Docker Hub
Heroku: Container Registry and Runtime

Heroku Acceptable Use Policy
Quota & Limits
Network Bandwidth: 2TB/month — Soft
Shared DB processing: Max 200msec per second CPU time — Soft
Dyno RAM usage: 512MB — Hard
Slug Size: 300MB — Hard
Request Length: 30 seconds — Hard