Files
apiautotest/dockerfile
2025-08-13 16:19:39 +08:00

35 lines
868 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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