Spaces:
Build error
Build error
# 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 / | |