Skip to content

Commit

Permalink
Merge pull request #19 from chxcode/add-dockerfile
Browse files Browse the repository at this point in the history
Add docker mode
  • Loading branch information
moyada authored Nov 30, 2020
2 parents 485d8a4 + 712c995 commit ad308d0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM python:3.6.8

ENV PYTHONUNBUFFERED 1

# 更新pip
RUN pip install --upgrade pip --index-url https://pypi.douban.com/simple

# 工作目录
WORKDIR /code
ADD . /code

# pip安装依赖包
RUN pip install -r requirements.txt --index-url https://pypi.douban.com/simple

# 打开容器的8000端口
EXPOSE 8000

# 执行命令行,启动django服务
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ pip3 install django-cors-headers

[试用地址](http://www.didaho.com/#/watermark)

### Docker 方式部署

1. 首先 `clone` 代码到服务器。
2. 构建镜像,切换文件夹 `cd stealer` 然后执行命令 `docker build -t stealer-1.0.0 -f Dockerfile .` 即可生成镜像文件。
3. 启动容器,执行命令 `docker run -d -p 8000:8000 stealer-1.0.0:latest`
4. 应用地址为: 服务器IP:8000
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Django>=3.0.1
django-cors-headers>=3.5.0
enum34>=1.1.10
requests>=2.22.0

0 comments on commit ad308d0

Please sign in to comment.