-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
46 lines (37 loc) · 1.55 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
FROM python:3.11.9-bookworm
# Install Node.js as it is needed for draco1 vs draco2 comparison demos
ENV NODE_MAJOR=20
RUN apt-get update && apt-get install -y ca-certificates curl gnupg && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update && apt-get install nodejs -y && \
npm install -g npm@latest
# Install Clingo so that it is available as an executable for the draco1 vs. draco2 comparison notebook
RUN apt-get update && apt-get install -y gringo
# Create user with a home directory
ARG NB_USER="draco2"
ARG NB_UID="1000"
ENV USER ${NB_USER}
ENV HOME /home/${NB_USER}
RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER}
WORKDIR ${HOME}/app
# Install dependencies using Poetry
# Installing all dependency groups to build a complete dev environment
COPY pyproject.toml poetry.lock ./
RUN python -m pip install --upgrade pip && \
pip install poetry && \
poetry config virtualenvs.create false && \
poetry install --with dev --with web
# Copy the project source code
COPY . .
# Install draco2 from local sources, needed for notebooks
RUN pip install -e .
# Install pre-commit hooks
RUN poetry run pre-commit install
# Grant permissions to the notebook user
RUN chown -R ${NB_USER} ${HOME}
USER ${NB_USER}