/
Dockerfile
136 lines (112 loc) · 4.84 KB
/
Dockerfile
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
ARG GNURADIO_IMAGE_TAG=satnogs
FROM librespace/gnuradio:${GNURADIO_IMAGE_TAG} as builder
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
WORKDIR /usr/local/src/
COPY packages.builder .
RUN apt -y update && \
apt -y upgrade && \
xargs -a packages.builder apt install --no-install-recommends -qy
ARG GRSATNOGS_URL=https://gitlab.com/librespacefoundation/satnogs/gr-satnogs.git
ARG GRSATNOGS_BRANCH=master
ARG GRSATNOGS_VER=2.3.4.0-1
ARG FLOWGRAPHS_URL=https://gitlab.com/librespacefoundation/satnogs/satnogs-flowgraphs.git
ARG FLOWGRAPHS_BRANCH=master
ARG FLOWGRAPHS_VER=1.5-1
ARG GRSOAPY_URL=https://gitlab.com/librespacefoundation/gr-soapy.git
ARG GRSOAPY_BRANCH=master
ARG GRSOAPY_VER=2.1.3.1-1
ARG CLIENT_URL=https://gitlab.com/librespacefoundation/satnogs/satnogs-client.git
ARG CLIENT_BRANCH=master
ARG CLIENT_VER=1.8.1
RUN git clone --depth 1 --branch "$GRSATNOGS_BRANCH" "$GRSATNOGS_URL"
RUN git clone --depth 1 --branch "$FLOWGRAPHS_BRANCH" "$FLOWGRAPHS_URL"
RUN git clone --depth 1 --branch "$GRSOAPY_BRANCH" "$GRSOAPY_URL"
RUN git clone --depth 1 --branch "$CLIENT_BRANCH" "$CLIENT_URL"
ARG RTLSDR_URL
ARG RTLSDR_BRANCH=master
ARG RTLSDR_VER=0.6.0-3satnogs1
RUN if [ -n "$RTLSDR_URL" ]; then \
git clone --depth 1 --branch "$RTLSDR_BRANCH" "$RTLSDR_URL" rtl-sdr && \
cd rtl-sdr && \
dch -m -b --distribution unstable -v $RTLSDR_VER Upstream master && \
DEB_BUILD_OPTIONS=noautodbgsym dpkg-buildpackage -b -us -uc && \
dpkg -i ../rtl-sdr_*.deb ../librtlsdr0_*.deb ;\
fi
RUN cd gr-soapy && \
dch -m -b --distribution unstable -v $GRSOAPY_VER Upstream master && \
DEB_BUILD_OPTIONS=noautodbgsym dpkg-buildpackage -b -us -uc && \
dpkg -i ../gr-soapy_*.deb ../libgnuradio-soapy_*.deb
RUN cd gr-satnogs && \
dch -m -b --distribution unstable -v $GRSATNOGS_VER Upstream master && \
DEB_BUILD_OPTIONS=noautodbgsym dpkg-buildpackage -b -us -uc && \
dpkg -i ../gr-satnogs_*.deb ../libgnuradio-satnogs_*.deb
RUN cd satnogs-flowgraphs && \
dch -m -b --distribution unstable -v $FLOWGRAPHS_VER Upstream master && \
DEB_BUILD_OPTIONS=noautodbgsym dpkg-buildpackage -b -us -uc && \
dpkg -i ../satnogs-flowgraphs_*.deb
ARG UHD_URL
RUN if [ -n "$UHD_URL" ]; then \
dget -q -u "$UHD_URL" &&\
cd uhd-* &&\
DEB_BUILD_OPTIONS=noautodbgsym dpkg-buildpackage -b -us -uc --build=binary &&\
cd .. &&\
rm -f libuhd*dpdk* libuhd-dev* uhd-doc* &&\
dpkg -i uhd-host_*.deb libuhd*.deb ;\
fi
RUN --mount=type=cache,id=debs,target=/debs \
mkdir -p /debs/$(dpkg --print-architecture)/ && \
rm -f /debs/$(dpkg --print-architecture)/* && \
cp *.deb /debs/$(dpkg --print-architecture)/
ARG MPLSETUPCFG=/etc/mplsetup.cfg
RUN --mount=type=cache,id=wheels,target=/wheels \
printf "[libs]\nsystem_freetype = true" > $MPLSETUPCFG && \
printf "[global]\nextra-index-url=https://www.piwheels.org/simple" > /etc/pip.conf && \
rm -f /wheels/satnogs* && \
pip3 install --upgrade pip setuptools wheel ujson --find-links=/wheels --prefer-binary && \
pip3 wheel -w /wheels --find-links=/wheels --prefer-binary \
-r ./satnogs-client/requirements.txt \
./satnogs-client
ARG GNURADIO_IMAGE_TAG=satnogs
FROM librespace/gnuradio:${GNURADIO_IMAGE_TAG} as runner
MAINTAINER sa2kng <knegge@gmail.com>
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
# make this depend on builder
COPY --from=builder /etc/pip.conf /etc
# Install deb packages from builder and optional repo
ARG OBS_REPO
COPY packages.client /usr/local/src/
RUN --mount=type=cache,id=debs,target=/debs \
if [ -n "${OBS_REPO}" ]; then \
echo "deb ${OBS_REPO} /" > /etc/apt/sources.list.d/obs_repo.list &&\
apt-key adv --fetch-keys "${OBS_REPO}/Release.key"; \
fi &&\
apt -y update && \
apt -y upgrade && \
xargs -a /usr/local/src/packages.client apt install -qy python3-pip && \
apt install -qy --allow-downgrades /debs/$(dpkg --print-architecture)/*.deb && \
apt -y autoremove && \
rm -rf /var/lib/apt/lists/*
# Install python packages from builder
RUN --mount=type=cache,id=wheels,target=/wheels \
pip3 install --no-cache --find-links=/wheels --no-index satnogs-client
ARG SATNOGS_CLIENT_UID=999
ARG SATNOGS_CLIENT_VARSTATEDIR=/var/lib/satnogs-client
# Add unprivileged system user
RUN groupadd -r -g ${SATNOGS_CLIENT_UID} satnogs-client \
&& useradd -r -u ${SATNOGS_CLIENT_UID} \
-g satnogs-client \
-d ${SATNOGS_CLIENT_VARSTATEDIR} \
-s /bin/false \
-G audio,dialout,plugdev \
satnogs-client
# Create application varstate directory
RUN install -d -o ${SATNOGS_CLIENT_UID} -g ${SATNOGS_CLIENT_UID} ${SATNOGS_CLIENT_VARSTATEDIR}
# Restore permissions on satyaml dir
RUN chown -R satnogs-client:satnogs-client /usr/lib/python3/dist-packages/satellites/satyaml
ARG UHD_URL
RUN if [ -n "$UHD_URL" ]; then \
uhd_images_downloader -q ;\
fi
WORKDIR $SATNOGS_CLIENT_VARSTATEDIR