generated from brunobotelhobr/My-Template-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
40 lines (30 loc) · 866 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM python:alpine3.20
# Update the system
RUN apk update && apk upgrade
# Create User
RUN mkdir /code
RUN adduser -D -h /code -s /bin/bash app
# install gcc
RUN apk update && apk add --no-cache python3-dev gcc libc-dev libffi-dev
# Install dependencies
RUN pip install --upgrade pip
RUN pip install setuptools
RUN pip install wheel
RUN pip install poetry
# Install the package
WORKDIR /code
COPY src src
COPY pyproject.toml /code/pyproject.toml
COPY README.md /code/README.md
# Install the packages
# Disable virtualenvs creation
RUN poetry config virtualenvs.create false
RUN poetry install --without dev,docs
# Adjust Permissions
RUN chown -R app:app /code/*
#Enable app User
USER app
HEALTHCHECK --interval=30s --timeout=3s \
CMD python /code/src/app/cmd.py version || exit 1
# # Define the entrypoint
ENTRYPOINT ["python", "/code/src/app/cmd.py"]