35 lines
868 B
Plaintext
35 lines
868 B
Plaintext
FROM python:3.9
|
||
|
||
# 使用国内镜像源(debian 镜像源)
|
||
RUN sed -i s:/deb.debian.org:/mirrors.tuna.tsinghua.edu.cn:g /etc/apt/sources.list.d/*
|
||
|
||
|
||
#设置时区
|
||
RUN echo "Asia/Shanghai" > /etc/timezone
|
||
|
||
# 安装JDK
|
||
RUN apt-get update && apt-get install -y default-jdk
|
||
|
||
# 安装git
|
||
RUN apt-get install -y git
|
||
|
||
# 克隆代码
|
||
RUN git clone --recurse-submodules https://gitlink.org.cn/kytest/apiautotest.git
|
||
|
||
# 设置工作目录
|
||
WORKDIR /apiautotest
|
||
COPY . .
|
||
|
||
# 安装pipenv
|
||
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pipenv
|
||
|
||
# 安装依赖
|
||
RUN pipenv install
|
||
|
||
# 运行
|
||
CMD ["pipenv", "run", "python", "run.py"]
|
||
|
||
# 构建docker镜像: docker build -f dockerfile -t apitest:2.0 .
|
||
# 删除docker镜像:docker rmi -f apitest:2.0
|
||
# 运行docker镜像:docker run --rm --name apitest apitest:2.0
|
||
# 进入容器内部:docker exec -it apitest /bin/bash |