-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
51 lines (41 loc) · 1.14 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
FROM python:3.12-slim-bullseye
# set environment variables
ENV PYTHONFAULTHANDLER=1 \
PYTHONHASHSEED=random \
PYTHONUNBUFFERED=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PYTHONPATH=/usr/src/app
RUN mkdir -p $PYTHONPATH
RUN mkdir -p $PYTHONPATH/static
RUN mkdir -p $PYTHONPATH/media
# where the code lives
WORKDIR $PYTHONPATH
RUN apt-get update && apt-get upgrade -y && apt-get install --no-install-recommends -y \
# dependencies for building Python packages
build-essential \
# psycopg2 dependencies
libpq-dev \
# curl
curl \
# translations
gettext
# install dependencies
RUN pip install --upgrade pip
RUN pip install setuptools
# install poetry
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH "/root/.local/bin:$PATH"
# copy python dependencies
COPY pyproject.toml poetry.lock ./
# disable virtualenv creation
RUN poetry config virtualenvs.create false
# install python dependencies
RUN poetry install --only main --no-interaction
# copy entrypoint.sh
COPY ./entrypoint /entrypoint
RUN sed -i 's/\r$//g' /entrypoint
RUN chmod +x /entrypoint
# install app
COPY . .
# run entrypoint.sh
ENTRYPOINT ["/entrypoint"]