File size: 2,042 Bytes
ad06298
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
55
56
57
58
59
60
61
62
63
64
65
66
FROM python:3.10

WORKDIR /home/

COPY ./requirements.txt /home/requirements.txt

RUN apt update && \
    apt install -y --no-install-recommends \
        curl \
        git \
        git-lfs \
        libatomic1 \
        locales \
        man \
        nano \
        net-tools \
        openssh-client \
        python3 \
        python3-pip \
        python3-venv \
        sudo \
        vim \
        wget \
        zsh \
        zip \
        unzip \
        ffmpeg \
        imagemagick \
    && git lfs install \
    && rm -rf /var/lib/apt/lists/*
ENV USERNAME=user \
    USER_UID=1000 \
    USER_GID=1000 \
    LANG=C.UTF-8 \
    LC_ALL=C.UTF-8 \
    NVIDIA_VISIBLE_DEVICES=all \
    NVIDIA_DRIVER_CAPABILITIES=all \
    EDITOR=code \
    VISUAL=code \
    GIT_EDITOR="code --wait" \
    OPENVSCODE_SERVER_ROOT=/home/.vscode \
    OPENVSCODE=/home/.vscode/bin/openvscode-server
ENV DEBIAN_FRONTEND=dialog
RUN wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
RUN sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
RUN wget https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/8.0/multiverse/binary-amd64/mongodb-org-server_8.0.0_amd64.deb
RUN sudo apt install ./mongodb-org-server_8.0.0_amd64.deb

RUN pip install --no-cache-dir --upgrade -r /home/requirements.txt

COPY . .
WORKDIR /home/user/

# Creating the user and usergroup
RUN groupadd --gid ${USER_GID} ${USERNAME} \
    && useradd --uid ${USER_UID} --gid ${USERNAME} -m -s /bin/bash ${USERNAME} \
    && echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
    && chmod 0440 /etc/sudoers.d/${USERNAME}

RUN chmod g+rw /home && \
    chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}
RUN mkdir -p /db && chown -R ${USERNAME}:${USERNAME} /db
USER $USERNAME
COPY . .
# Install oh-my-zsh & Init# Start MongoDB and Flask
CMD ["sh", "-c", "Malloc=system mongod --dbpath /db --logpath mongod.log --fork && flask run --host=0.0.0.0 --port=7860"]