-
Notifications
You must be signed in to change notification settings - Fork 79
/
dev.Dockerfile
49 lines (43 loc) · 1.93 KB
/
dev.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
41
42
43
44
45
46
47
48
49
# build with
# docker build -t some_tag_search -f Dockerfile ../..
FROM python:3.9.18-slim
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_NO_INTERACTION=1 \
# Versions:
POETRY_VERSION=1.8.2 \
POETRY_VIRTUALENVS_IN_PROJECT=true \
PATH="$PATH:/root/.local/bin"
# System deps:
RUN apt-get update \
&& apt-get install -y gcc g++ unzip wget procps htop ffmpeg libavcodec-extra libsndfile1 \
&& rm -rf /var/lib/apt/lists/*
RUN pip install -U pip
RUN pip install "poetry==$POETRY_VERSION"
WORKDIR /src
COPY libs/libcommon/poetry.lock ./libs/libcommon/poetry.lock
COPY libs/libcommon/pyproject.toml ./libs/libcommon/pyproject.toml
COPY libs/libapi/poetry.lock ./libs/libapi/poetry.lock
COPY libs/libapi/pyproject.toml ./libs/libapi/pyproject.toml
COPY services/search/poetry.lock ./services/search/poetry.lock
COPY services/search/pyproject.toml ./services/search/pyproject.toml
# FOR LOCAL DEVELOPMENT ENVIRONMENT
# Initialize an empty libcommon
# Mapping a volume to ./libs/libcommon/src is required when running this image.
RUN mkdir ./libs/libcommon/src && mkdir ./libs/libcommon/src/libcommon && touch ./libs/libcommon/src/libcommon/__init__.py
# Initialize an empty libapi
# Mapping a volume to ./libs/libapi/src is required when running this image.
RUN mkdir ./libs/libapi/src && mkdir ./libs/libapi/src/libapi && touch ./libs/libapi/src/libapi/__init__.py
# Install dependencies
WORKDIR /src/services/search/
RUN --mount=type=cache,target=/home/.cache/pypoetry/cache \
--mount=type=cache,target=/home/.cache/pypoetry/artifacts \
poetry install --no-root
# FOR LOCAL DEVELOPMENT ENVIRONMENT
# Install the search package.
# Mapping a volume to ./services/search/src is required when running this image.
ENTRYPOINT ["/bin/sh", "-c" , "poetry install --only-root && poetry run python src/search/main.py"]