File size: 3,346 Bytes
6c2c879
 
 
a5bf401
6c2c879
a5bf401
6c2c879
a5bf401
6c2c879
a5bf401
6c2c879
a5bf401
 
be98496
 
a5bf401
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
825a228
4aa8856
 
 
0db9542
 
 
4aa8856
 
 
50ea42f
 
 
c2ba911
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile

# FROM python:3.9

# WORKDIR /code

# COPY ./requirements.txt /code/requirements.txt

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

# COPY . .

# CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]

#FROM nvcr.io/nvidia/tensorflow:23.07-tf2-py3
FROM tensorflow/tensorflow:2.15.0
# use the cpu image that the nvidia image was based on

# specify vscode as the user name in the docker
# This user name should match that of the VS Code .devcontainer to allow seamless development inside the docker container via vscode 
ARG USERNAME=vscode
ARG USER_UID=1001
ARG USER_GID=$USER_UID

# Create a non-root user
RUN groupadd --gid $USER_GID $USERNAME \
  && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
  # [Optional] Add sudo support for the non-root user - this is ok for development dockers only
  && apt-get update \
  && apt-get install -y sudo \
  && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
  && chmod 0440 /etc/sudoers.d/$USERNAME \
  # Cleanup
  && rm -rf /var/lib/apt/lists/* \
  # Set up git completion.
  && echo "source /usr/share/bash-completion/completions/git" >> /home/$USERNAME/.bashrc 

# Packages installation (eg git-lfs)
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
    && apt-get -y install --no-install-recommends curl git-lfs ffmpeg libsm6 libxext6 graphviz libsndfile1-dev libgraphviz-dev xdg-utils swig gringo gobject-introspection libcairo2-dev libgirepository1.0-dev pkg-config python3-dev python3-gi python3-tk

#COPY docker/docker-font.conf /etc/fonts/local.conf
#ENV FREETYPE_PROPERTIES="truetype:interpreter-version=35"
#RUN echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections
#RUN apt-get update \
	#&& apt-get install -y --no-install-recommends fontconfig ttf-mscorefonts-installer


USER vscode

# ACT for executing locally Github workflows
RUN curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh |  sudo bash

# NVM for managing npm versions
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh |  sudo bash

# Git LFS repo configuration
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh |  sudo  bash

# inscape installation for managing svg files
RUN sudo apt-get update && export DEBIAN_FRONTEND=noninteractive \
    && sudo apt-get -y install --no-install-recommends inkscape


SHELL ["/bin/bash", "-c"]
ENV PATH="/home/vscode/.local/bin:$PATH"
ENV GI_TYPELIB_PATH="/usr/lib/x86_64-linux-gnu/girepository-1.0"

# Install dependencies:
# COPY . . 
# RUN pip install -r requirements.txt

RUN pip install --upgrade pip
RUN pip install pipenv
COPY Pipfile.lock Pipfile /tmp/
WORKDIR /tmp
RUN pipenv install --system --deploy --ignore-pipfile

WORKDIR /workspaces/artificial_intelligence

COPY . . 

# Switch to root user to change permissions
USER root

# Set permissions for the directory
RUN chmod -R 777 /workspaces/artificial_intelligence

# Switch back to a non-root user
USER vscode

# Commands to run application and display picture
RUN python main.py

RUN docker cp my_container:/workspaces/artificial_intelligence/figure.jpg /