2021-12-29 18:53:22 +08:00
|
|
|
|
# Ubuntu 20.04
|
|
|
|
|
FROM ubuntu:focal
|
|
|
|
|
|
|
|
|
|
# 切换默认shell为bash
|
|
|
|
|
SHELL ["/bin/bash", "-c"]
|
|
|
|
|
|
|
|
|
|
ADD ./ /asrt_server
|
|
|
|
|
|
|
|
|
|
WORKDIR /asrt_server
|
|
|
|
|
|
|
|
|
|
# 最小化源,缩短apt update时间(ca-certificates必须先安装才支持换tsinghua源)
|
|
|
|
|
RUN echo 'deb http://archive.ubuntu.com/ubuntu/ focal main restricted' > /etc/apt/sources.list
|
|
|
|
|
|
|
|
|
|
RUN apt update && apt install -y ca-certificates
|
|
|
|
|
|
|
|
|
|
RUN echo $'\
|
|
|
|
|
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse\
|
|
|
|
|
\n# deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse\n\
|
|
|
|
|
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse\
|
|
|
|
|
\n# deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse\n\
|
|
|
|
|
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse\
|
|
|
|
|
\n# deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse\n\
|
|
|
|
|
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse\
|
|
|
|
|
\n# deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse\n\
|
|
|
|
|
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse\
|
|
|
|
|
\n# deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse'\
|
|
|
|
|
> /etc/apt/sources.list
|
|
|
|
|
|
|
|
|
|
RUN apt update && apt install -y python3 python3-pip
|
|
|
|
|
|
|
|
|
|
RUN pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
|
|
|
|
|
2022-03-22 20:58:02 +08:00
|
|
|
|
RUN pip3 install wave scipy matplotlib tensorflow-cpu==2.5.3 numpy==1.19.2 requests flask waitress
|
2021-12-29 18:53:22 +08:00
|
|
|
|
|
2022-03-21 22:13:56 +08:00
|
|
|
|
RUN echo $'cd /asrt_server \n python3 asrserver_http.py' > /asrt_server/start.sh && chmod +x /asrt_server/start.sh
|
2021-12-29 18:53:22 +08:00
|
|
|
|
|
|
|
|
|
# refer: https://docs.docker.com/engine/reference/builder/#expose
|
2022-03-21 22:13:56 +08:00
|
|
|
|
EXPOSE 20001/tcp
|
2021-12-29 18:53:22 +08:00
|
|
|
|
|
|
|
|
|
ENTRYPOINT ["/bin/bash", "/asrt_server/start.sh"]
|
|
|
|
|
|
|
|
|
|
# https://docs.docker.com/engine/reference/commandline/build/#options
|
2022-03-26 23:18:10 +08:00
|
|
|
|
# docker build --progress plain --rm --build-arg TAG=1.2.0 --tag asrt/api_server:1.2.0 .
|
2021-12-29 18:53:22 +08:00
|
|
|
|
# https://docs.docker.com/engine/reference/commandline/run/#options
|
2022-03-26 23:18:10 +08:00
|
|
|
|
# docker run --rm -it -p 20001:20001 --name asrt -d asrt/api_server:1.2.0
|