Skip to content

Commit

Permalink
Add Dockerfile for running Python-based REST API
Browse files Browse the repository at this point in the history
  • Loading branch information
PGijsbers committed Oct 20, 2023
1 parent ad048b2 commit 9007610
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
14 changes: 12 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
MYSQL_ROOT_PASSWORD: ok
ports:
- "3306:3306"
-

docs:
build:
context: .
Expand All @@ -19,4 +19,14 @@ services:
php-api:
image: "openml/php-rest-api"
ports:
- "8001:80"
- "8002:80"

python-api:
container_name: "python-api"
build:
context: .
dockerfile: docker/python/Dockerfile
ports:
- "8001:8000"
volumes:
- .:/python-api
14 changes: 14 additions & 0 deletions docker/python/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM python:3.12-bookworm

RUN apt-get update \
&& apt-get install -y python3-dev default-libmysqlclient-dev build-essential pkg-config

COPY . /python-api
WORKDIR /python-api

RUN python -m pip install --upgrade pip
RUN python -m pip install -e ".[dev]"

EXPOSE 8000
ENTRYPOINT ["uvicorn"]
CMD ["src.main:app", "--host", "0.0.0.0"]

0 comments on commit 9007610

Please sign in to comment.