-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
54 lines (41 loc) · 1.21 KB
/
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
50
51
52
53
54
FROM python:3.12.5-slim
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONPYCACHEPREFIX=/tmp/pycache
ENV POETRY_NO_INTERACTION=1
ENV POETRY_VIRTUALENVS_CREATE=0
ENV POETRY_CACHE_DIR=/tmp/poetry_cache
ENV MYPY_CACHE_DIR=/tmp/mypy_cache
ARG uid=1000
RUN apt-get update \
# dependencies for building Python packages
&& apt-get install -y build-essential git \
# psycopg2 dependencies
&& apt-get install -y libpq-dev \
# Additional dependencies
&& apt-get install -y telnet netcat-traditional psmisc procps \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
RUN pip install poetry
WORKDIR /app
RUN adduser --disabled-password --gecos '' -u ${uid} ddlh
RUN chown -R ddlh:ddlh /app
USER ddlh
COPY pyproject.toml poetry.lock ./
USER root
RUN chown -R ddlh:ddlh /app
USER ddlh
RUN poetry lock --no-update
USER root
RUN poetry install --no-root && rm -rf $POETRY_CACHE_DIR
USER ddlh
COPY . .
RUN git config --global --add safe.directory /app
USER root
RUN chmod +x ./entrypoint.sh
RUN chmod +x ./start_web.sh
RUN chmod +x ./start_celeryworker.sh
RUN chmod +x ./start_flower.sh
USER ddlh
ENTRYPOINT ["./entrypoint.sh"]