-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add dockerfile debian source args; add usage img
- Loading branch information
Showing
6 changed files
with
35 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.git | ||
**/*.log | ||
**/*-log-* | ||
**/*.tar.gz | ||
Dockerfile | ||
.dockerignore | ||
*.md | ||
.github | ||
docs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,44 @@ | ||
|
||
# 使用官方Python 3.9镜像作为基础镜像 | ||
FROM python:3.9-buster | ||
|
||
# 设置环境变量 | ||
ENV JMETER_VERSION 5.5 | ||
ENV JMETER_HOME /opt/apache-jmeter-${JMETER_VERSION} | ||
ENV PATH ${JMETER_HOME}/bin:${PATH} | ||
|
||
# 更换apt源为阿里云镜像源,更新系统和安装一些基本软件包 | ||
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \ | ||
apt-get update && \ | ||
ARG DEBIAN_REPO="deb.debian.org" | ||
|
||
|
||
ARG DEBIAN_REPO="deb.debian.org" | ||
ARG PIP_INDEX_URL="https://pypi.org/simple" | ||
|
||
# replace sources.list, if use docker-compose | ||
RUN echo "deb http://$DEBIAN_REPO/debian/ buster main contrib non-free" > /etc/apt/sources.list && \ | ||
echo "deb-src http://$DEBIAN_REPO/debian/ buster main contrib non-free" >> /etc/apt/sources.list && \ | ||
echo "deb http://$DEBIAN_REPO/debian-security buster/updates main contrib non-free" >> /etc/apt/sources.list && \ | ||
echo "deb-src http://$DEBIAN_REPO/debian-security buster/updates main contrib non-free" >> /etc/apt/sources.list && \ | ||
echo "deb http://$DEBIAN_REPO/debian/ buster-updates main contrib non-free" >> /etc/apt/sources.list && \ | ||
echo "deb-src http://$DEBIAN_REPO/debian/ buster-updates main contrib non-free" >> /etc/apt/sources.list | ||
|
||
# update apt-get and install packages | ||
RUN apt-get update && \ | ||
apt-get install -y wget unzip openjdk-11-jdk ant | ||
|
||
# 安装JMeter | ||
# install JMeter | ||
RUN wget https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-${JMETER_VERSION}.tgz && \ | ||
tar -xzf apache-jmeter-${JMETER_VERSION}.tgz -C /opt && \ | ||
rm apache-jmeter-${JMETER_VERSION}.tgz && \ | ||
chmod +x ${JMETER_HOME}/bin/jmeter | ||
|
||
ARG PIP_INDEX_URL="https://pypi.org/simple" | ||
|
||
# 安装项目依赖 | ||
# install python packages | ||
COPY requirements.txt /app/requirements.txt | ||
RUN pip install -r /app/requirements.txt -i ${PIP_INDEX_URL} | ||
|
||
# 设置工作目录 | ||
WORKDIR /app | ||
|
||
# 将项目文件拷贝到工作目录 | ||
COPY . . | ||
|
||
# 暴露8000端口 | ||
EXPOSE 8000 | ||
|
||
# 启动FastAPI应用 | ||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.