유명현

Add Dockerfile, docker-compose.yml, etc.

FROM python:3
WORKDIR /usr/src/app
EXPOSE 8080
COPY . .
RUN pip install --no-cache-dir -r requirements.txt
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
\ No newline at end of file
docker build . -t daangn
docker-compose up -d
\ No newline at end of file
version: "3"
services:
api:
build:
context: .
dockerfile: ./Dockerfile
ports:
- 18080:8080
......@@ -5,7 +5,7 @@ import daangn_crawl
# uvicorn main:app --reload
app = FastAPI()
@app.get("/daangn/{item}")
@app.get("/api/v2/daangn/{item}")
def read_item(item: str, q: Optional[str] = None):
crawl_json = daangn_crawl.crawl(item)
return crawl_json
\ No newline at end of file
......
beautifulsoup4==4.10.0
fastapi==0.77.1
requests==2.27.1
uvicorn==0.17.6
docker-compose down
docker image rm daangn
\ No newline at end of file