Skip to content

Commit

Permalink
FastAPI test with docker
Browse files Browse the repository at this point in the history
Dockerfile을 이용해 Docker환경에서 작업을 진행하였습니다.
  • Loading branch information
ehddnr301 committed Aug 25, 2021
1 parent 6de4ec9 commit 2390935
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM python:3.8
EXPOSE 80
COPY ./ /app
WORKDIR /app
RUN pip install -r requirements.txt
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"]
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,14 @@

- 테스트결과

![테스트이미지](./image/test_image1.png)
![테스트이미지](./image/test_image1.png)

### With Docker

- 도커환경에서 필요한 라이브러리를 설치할수있게 pip freeze로 requirements.txt를 생성해주었습니다.
- `docker build -t fastapi .` 명령어로 도커 이미지를 생성합니다.
- `docker run -d --name fastapiContainer -p 80:80 fastapi` 명령어로 fastapi 이미지를 fastapiContainer라는 컨테이너 이름으로 실행합니다.

- 테스트결과

![테스트이미지](./image/test_image2.png)
Binary file added image/test_image2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added requirements.txt
Binary file not shown.

0 comments on commit 2390935

Please sign in to comment.