aboutsummaryrefslogtreecommitdiffstats
path: root/osmo-ggsn-master/Dockerfile
blob: 2c5a91fdeba25335ac13344aed5a8dac4dccdc67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
ARG	USER
ARG	DISTRO
FROM	$USER/$DISTRO-build
# Arguments used after FROM must be specified again
ARG	DISTRO

# Disable update-initramfs to save time during apt-get install
RUN	case "$DISTRO" in \
	debian*) \
		ln -s /bin/true /usr/local/bin/update-initramfs && \
		apt-get update && \
		apt-get install -y --no-install-recommends \
			bc \
			bridge-utils \
			busybox-static \
			ca-certificates \
			iproute2 \
			libelf-dev \
			libgtpnl-dev \
			libosmocore-dev \
			linux-image-amd64 \
			pax-utils \
			qemu-system-x86 && \
		apt-get clean \
		;; \
	centos*) \
		dnf install -y \
			"pkgconfig(libgtpnl)" \
			"pkgconfig(libmnl)" \
			"pkgconfig(libosmocore)" \
			"pkgconfig(libosmoctrl)" \
			"pkgconfig(libosmovty)" \
		;; \
	esac

RUN apt-get update && \
    apt-get upgrade -y && \
    DEBIAN_FRONTEND=noninteractive \
    apt-get install -y --no-install-recommends \
        gdb \
        libtalloc-dev \
        tcpdump && \
    apt-get clean

WORKDIR	/tmp

# Download, build and install libosmocore
ARG     LIBOSMOCORE_BRANCH="master"
RUN     git clone https://gerrit.osmocom.org/libosmocore
ADD     https://gerrit.osmocom.org/plugins/gitiles/libosmocore/+/$LIBOSMOCORE_BRANCH?format=TEXT /tmp/commit-libosmocore

RUN     cd libosmocore \
        && git fetch && git checkout -f -B $LIBOSMOCORE_BRANCH origin/$LIBOSMOCORE_BRANCH \
        && git rev-parse --abbrev-ref HEAD && git rev-parse HEAD \
        && autoreconf -fi \
        && ./configure \
                --disable-doxygen \
                --disable-pcsc \
                --prefix=/usr/local \
                --enable-sanitize \
        && make -j5 \
        && make install \
        && make distclean && ldconfig

ARG	OSMO_GGSN_BRANCH="master"

RUN	git clone https://gerrit.osmocom.org/osmo-ggsn.git
ADD	https://gerrit.osmocom.org/plugins/gitiles/osmo-ggsn/+/$OSMO_GGSN_BRANCH?format=TEXT /tmp/commit-osmo-ggsn

RUN	cd osmo-ggsn && \
	git fetch && git checkout $OSMO_GGSN_BRANCH && \
	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_GGSN_BRANCH || exit 1); \
	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
	autoreconf -fi && \
	./configure --enable-gtp-linux --enable-sanitize && \
	make "-j$(nproc)" install && \
	ldconfig

VOLUME	/data

COPY	osmo-ggsn.cfg /data/osmo-ggsn.cfg

WORKDIR	/data
CMD	["/bin/sh", "-c", "/usr/local/bin/osmo-ggsn -c /data/osmo-ggsn.cfg >/data/osmo-ggsn.log 2>&1"]

EXPOSE	3386/udp 2123/udp 2152/udp 4257/tcp 4260/tcp