Skip to content

Commit 42ab60b

Browse files
committed
Add docker files for OpenSIPS master version build
0 parents  commit 42ab60b

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed

Dockerfile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM debian:jessie
2+
MAINTAINER Razvan Crainea <[email protected]>
3+
4+
USER root
5+
ENV DEBIAN_FRONTEND noninteractive
6+
ARG VERSION=2.2
7+
8+
WORKDIR /usr/local/src
9+
10+
RUN apt-get update -qq && apt-get install -y build-essential \
11+
git bison flex m4 pkg-config libncurses5-dev rsyslog
12+
13+
RUN git clone https://github.com/OpenSIPS/opensips.git -b $VERSION opensips_$VERSION
14+
RUN cd opensips_$VERSION && make all && make install
15+
16+
RUN echo -e "local0.* -/var/log/opensips.log\n& stop" > /etc/rsyslog.d/opensips.conf
17+
RUN touch /var/log/opensips.log
18+
19+
EXPOSE 5060/udp
20+
21+
COPY run.sh /run.sh
22+
23+
ENTRYPOINT ["/run.sh"]

Makefile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
NAME ?= opensips
2+
OPENSIPS_VERSION ?= 2.2
3+
4+
all: build start
5+
6+
.PHONY: build start
7+
build:
8+
docker build --build-arg=VERSION=$(OPENSIPS_VERSION) --tag="opensips/opensips:$(OPENSIPS_VERSION)" .
9+
10+
start:
11+
docker run -d --name $(NAME) opensips/opensips:$(OPENSIPS_VERSION)

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# OpenSIPS Docker Image
2+
http://www.opensips.org/
3+
4+
Docker recipe for building and starting an OpenSIPS image
5+
6+
## Building the image
7+
You can build the docker image by running:
8+
```
9+
make build
10+
```
11+
12+
This command will build a docker image with OpenSIPS master version taken from
13+
the git repository. To build a different git version, you can run:
14+
```
15+
OPENSIPS_VERSION=2.2 make build
16+
```
17+
18+
To start the image, simply run:
19+
```
20+
make start
21+
```

run.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
HOST_IP=$(ip route get 8.8.8.8 | head -n +1 | tr -s " " | cut -d " " -f 7)
4+
5+
sed -i "s/listen=.*/listen=udp:${HOST_IP}:5060/g" /usr/local/etc/opensips/opensips.cfg
6+
7+
service rsyslog start
8+
9+
/usr/local/sbin/opensipsctl start
10+
11+
tail -f /var/log/opensips.log

0 commit comments

Comments
 (0)