forked from singnet/das-poc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.service
61 lines (47 loc) · 1.57 KB
/
Dockerfile.service
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
FROM python:3.9
ARG USER_ID
ARG GROUP_ID
ARG git_owner="singnet"
ARG git_repo="das"
ARG git_branch="service_deployment"
ENV SINGNET_DIR=/opt/${git_owner}
ENV PROJECT_DIR=/opt/${git_owner}/${git_repo}
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV PYTHONPATH="${PYTONPATH}:${PROJECT_DIR}/das"
ENV LD_LIBRARY_PATH=/usr/local/lib
RUN mkdir -p ${PROJECT_DIR}
ENV TZ=GMT
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && \
apt-get install -y \
apt-utils \
curl \
git \
libudev-dev \
libusb-1.0-0-dev \
nano \
software-properties-common \
vim \
wget \
tzdata \
zip
RUN python3 -m pip install -U --force-reinstall pip && \
python3 -m pip install cython && \
python3 -m pip install protobuf==3.20 && \
python3 -m pip install snet-cli
RUN SNETD_VERSION=`curl -s https://api.github.com/repos/singnet/snet-daemon/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")'` && \
cd /tmp && \
wget https://github.com/singnet/snet-daemon/releases/download/${SNETD_VERSION}/snet-daemon-${SNETD_VERSION}-linux-amd64.tar.gz && \
tar -xvf snet-daemon-${SNETD_VERSION}-linux-amd64.tar.gz && \
mv snet-daemon-${SNETD_VERSION}-linux-amd64/snetd /usr/bin/snetd
ADD ./requirements.txt ${SINGNET_DIR}
RUN cd ${SINGNET_DIR} && \
python3 -m pip install -r requirements.txt
ADD . ${PROJECT_DIR}
RUN addgroup --gid $GROUP_ID user && \
adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID user
RUN cd ${PROJECT_DIR}/service && \
./build-proto.sh
USER user
WORKDIR ${PROJECT_DIR}