-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
36 lines (29 loc) · 1005 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
FROM python:3.10-slim-buster
# Set environment variables.
# Force Python stdout and stderr streams to be unbuffered.
# command.
ENV PYTHONUNBUFFERED=1
# Use /project folder as a directory where the source code is stored.
WORKDIR /project
## Install the project requirements ##
# using poetry
RUN --mount=type=cache,target=/root/.cache/pip \
pip install poetry
COPY pyproject.toml poetry.lock .
RUN poetry config virtualenvs.create false
RUN --mount=type=cache,target=/root/.cache/pypoetry \
poetry install --without local --no-root
# or using pip
# COPY requirements.txt .
# RUN --mount=type=cache,target=/root/.cache/pip \
# pip install -r requirements.txt
# Add user that will be used in the container.
RUN useradd app
# Set this directory to be owned by the "app" user.
RUN chown app:app /project
# Copy the source code of the project into the container.
COPY --chown=app:app . .
# grpc service
# CMD python main.py grpc
# telegram polling service
CMD ["python", "main.py", "poll"]