radames commited on
Commit
b37e887
1 Parent(s): a677067

codespace install script

Browse files
.devcontainer/Dockerfile ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/codespaces-linux/.devcontainer/base.Dockerfile
2
+
3
+ FROM mcr.microsoft.com/vscode/devcontainers/universal:2-focal
4
+
5
+ # ** [Optional] Uncomment this section to install additional packages. **
6
+ # USER root
7
+ #
8
+ # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
9
+ # && apt-get -y install --no-install-recommends <your-package-list-here>
10
+ #
11
+ # USER codespace
.devcontainer/devcontainer.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "postCreateCommand": "oryx build -p virtualenv_name=.venv --log-file /tmp/oryx-build.log --manifest-dir /tmp || echo 'Could not auto-build. Skipping.' && make install-deps",
3
+ "hostRequirements": {
4
+ "gpus": 1
5
+ },
6
+ "features": {
7
+ "ghcr.io/devcontainers/features/nvidia-cuda:1": {
8
+ "installCudnn": true
9
+ }
10
+ },
11
+ "build": {
12
+ "dockerfile": "Dockerfile"
13
+ },
14
+ "customizations": {
15
+ "vscode": {
16
+ "extensions": [
17
+ "GitHub.vscode-pull-request-github"
18
+ ]
19
+ }
20
+ },
21
+ "mounts": [
22
+ "source=codespaces-linux-var-lib-docker,target=/var/lib/docker,type=volume"
23
+ ],
24
+ "runArgs": [
25
+ "--cap-add=SYS_PTRACE",
26
+ "--security-opt",
27
+ "seccomp=unconfined",
28
+ "--privileged",
29
+ "--init"
30
+ ],
31
+ "remoteUser": "codespace"
32
+ }
.devcontainer/setup-python-tools.sh ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ PYTHON=${1:-"python"}
6
+ USERNAME=${2-"automatic"}
7
+
8
+ # Make sure we run the command as non-root user
9
+ sudoUserIf() {
10
+ if [ "$(id -u)" -eq 0 ] && [ "${USERNAME}" != "root" ]; then
11
+ sudo -u ${USERNAME} "$@"
12
+ else
13
+ "$@"
14
+ fi
15
+ }
16
+
17
+ installPythonPackage() {
18
+ PACKAGE=${1:-""}
19
+ VERSION=${2:-"latest"}
20
+
21
+ # pip skips installation if the package is already installed
22
+ echo "Installing $PACKAGE..."
23
+ if [ "${VERSION}" = "latest" ]; then
24
+ sudoUserIf ${PYTHON} -m pip install ${PACKAGE} --no-cache-dir
25
+ else
26
+ sudoUserIf ${PYTHON} -m pip install ${PACKAGE}=="${VERSION}" --no-cache-dir
27
+ fi
28
+ }
29
+
30
+ # If in automatic mode, determine if a user already exists, if not use vscode
31
+ if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
32
+ USERNAME=""
33
+ POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)")
34
+ for CURRENT_USER in ${POSSIBLE_USERS[@]}; do
35
+ if id -u ${CURRENT_USER} > /dev/null 2>&1; then
36
+ USERNAME=${CURRENT_USER}
37
+ break
38
+ fi
39
+ done
40
+ if [ "${USERNAME}" = "" ]; then
41
+ USERNAME=vscode
42
+ fi
43
+ elif [ "${USERNAME}" = "none" ]; then
44
+ USERNAME=root
45
+ USER_UID=0
46
+ USER_GID=0
47
+ fi
48
+
49
+ # Make sure that Python is available
50
+ if ! ${PYTHON} --version > /dev/null ; then
51
+ echo "You need to install Python before installing packages"
52
+ exit 1
53
+ fi
54
+
55
+ installPythonPackage "numpy" "latest"
56
+ installPythonPackage "pandas" "latest"
57
+ installPythonPackage "scipy" "latest"
58
+ installPythonPackage "matplotlib" "latest"
59
+ installPythonPackage "seaborn" "latest"
60
+ installPythonPackage "scikit-learn" "latest"
61
+ installPythonPackage "tensorflow" "latest"
62
+ installPythonPackage "keras" "latest"
63
+ installPythonPackage "torch" "latest"
64
+ installPythonPackage "requests" "latest"
Makefile CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  build-client:
2
  cd frontend && npm install && PUBLIC_DEV_MODE=PROD npm run build && rm -rf ../static && cp -r build/ ../static/
3
  build-dev:
 
1
+ install-deps:
2
+ sudo apt-get update
3
+ xargs -r -a packages.txt sudo apt-get install -y
4
+ pip install -r requirements.txt
5
+ cd frontend && npm install && cp .env.development.example .env.development && cp .env.example .env
6
  build-client:
7
  cd frontend && npm install && PUBLIC_DEV_MODE=PROD npm run build && rm -rf ../static && cp -r build/ ../static/
8
  build-dev:
frontend/.env.development.example ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ PUBLIC_WS_INPAINTING="ws://0.0.0.0:7860/gradio/queue/join"
2
+ PUBLIC_UPLOADS="http://0.0.0.0:7860/uploads"