Skip to content

Commit fa8d371

Browse files
committed
Docker image now uses server.py and python 3.11
- Added healthcheck
1 parent 1987525 commit fa8d371

File tree

9 files changed

+21
-448
lines changed

9 files changed

+21
-448
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
*
22
!tibiapy
3-
!serve.py
3+
!server.py
44
!setup.py
55
!requirements.txt
66
!README.md

.run/Docker.run.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<configuration default="false" name="Docker" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
33
<deployment type="dockerfile">
44
<settings>
5-
<option name="imageTag" value="tibiapy:dev" />
5+
<option name="imageTag" value="tibiapy:local" />
66
<option name="containerName" value="tibiapy" />
77
<option name="portBindings">
88
<list>

Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
FROM python:3.9-slim
1+
FROM python:3.11-slim
22
RUN apt-get update \
3-
&& apt-get install gcc -y \
3+
&& apt-get install gcc curl -y \
44
&& apt-get clean
55
WORKDIR /app
66
COPY requirements.txt .
7-
RUN pip install -r requirements.txt uvloop
7+
RUN pip install -r requirements.txt uvicorn
88

99
LABEL maintainer="Allan Galarza <[email protected]>"
1010
LABEL org.opencontainers.image.licenses="Apache 2.0"
@@ -17,6 +17,8 @@ LABEL org.opencontainers.image.description="API that parses website content into
1717

1818

1919
COPY . .
20-
RUN python setup.py install
20+
RUN pip install .[server]
2121
EXPOSE 8000
22-
CMD ["python", "serve.py"]
22+
HEALTHCHECK --interval=60s --timeout=10s --start-period=5s --retries=5 \
23+
CMD curl --fail http://localhost:8000/healthcheck || exit 1
24+
ENTRYPOINT ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "8000"]

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ lxml
33
aiohttp
44
aiohttp-socks
55
html5lib
6-
pydantic
6+
pydantic~=1.10

0 commit comments

Comments
 (0)