Spaces:
Sleeping
Sleeping
debian
Browse files- Dockerfile +18 -14
- pixi_install.sh +0 -128
- pup +7 -7
Dockerfile
CHANGED
@@ -1,29 +1,33 @@
|
|
1 |
-
FROM
|
2 |
|
3 |
-
RUN
|
|
|
|
|
4 |
|
5 |
# Create user
|
6 |
-
RUN
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
11 |
|
12 |
USER user
|
13 |
|
14 |
ENV HOME=/home/user \
|
15 |
PATH=/home/user/.local/bin:$PATH \
|
16 |
-
|
17 |
-
PUP=/home/user/pup/pup
|
18 |
|
19 |
-
WORKDIR $
|
20 |
|
21 |
-
COPY --chown=user
|
22 |
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
25 |
RUN pup py3.11
|
26 |
-
RUN pwd && ls -la
|
27 |
|
28 |
EXPOSE 7860
|
29 |
# CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
1 |
+
FROM debian:latest AS base
|
2 |
|
3 |
+
RUN apt-get update \
|
4 |
+
&& apt-get install -y curl \
|
5 |
+
&& apt-get clean
|
6 |
|
7 |
# Create user
|
8 |
+
RUN useradd -m -u 1000 user
|
9 |
+
# RUN mkdir -p /home/user && \
|
10 |
+
# mkdir -p /etc/skel
|
11 |
+
# RUN echo "user:x:1000:1000::/home/user:/bin/bash" >> /etc/passwd && \
|
12 |
+
# echo "user:x:1000:" >> /etc/group
|
13 |
+
# RUN chown -R user:user /home/user
|
14 |
|
15 |
USER user
|
16 |
|
17 |
ENV HOME=/home/user \
|
18 |
PATH=/home/user/.local/bin:$PATH \
|
19 |
+
PUP=/home/user/pup
|
|
|
20 |
|
21 |
+
WORKDIR $HOME
|
22 |
|
23 |
+
COPY --chown=user pup .
|
24 |
|
25 |
+
CMD ["bash"]
|
26 |
+
|
27 |
+
|
28 |
+
FROM base
|
29 |
+
RUN $PUP
|
30 |
RUN pup py3.11
|
|
|
31 |
|
32 |
EXPOSE 7860
|
33 |
# CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
pixi_install.sh
DELETED
@@ -1,128 +0,0 @@
|
|
1 |
-
#!/usr/bin/env bash
|
2 |
-
set -euo pipefail
|
3 |
-
|
4 |
-
__wrap__() {
|
5 |
-
|
6 |
-
VERSION=${PIXI_VERSION:-latest}
|
7 |
-
PIXI_HOME=${PIXI_HOME:-"$HOME/.pixi"}
|
8 |
-
BIN_DIR="$PIXI_HOME/bin"
|
9 |
-
|
10 |
-
REPO=prefix-dev/pixi
|
11 |
-
PLATFORM=$(uname -s)
|
12 |
-
ARCH=$(uname -m)
|
13 |
-
|
14 |
-
if [[ $PLATFORM == "Darwin" ]]; then
|
15 |
-
PLATFORM="apple-darwin"
|
16 |
-
elif [[ $PLATFORM == "Linux" ]]; then
|
17 |
-
PLATFORM="unknown-linux-musl"
|
18 |
-
fi
|
19 |
-
|
20 |
-
if [[ $ARCH == "arm64" ]] || [[ $ARCH == "aarch64" ]]; then
|
21 |
-
ARCH="aarch64"
|
22 |
-
fi
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
BINARY="pixi-${ARCH}-${PLATFORM}"
|
27 |
-
|
28 |
-
if [[ $VERSION == "latest" ]]; then
|
29 |
-
DOWNLOAD_URL=https://github.com/${REPO}/releases/latest/download/${BINARY}.tar.gz
|
30 |
-
else
|
31 |
-
DOWNLOAD_URL=https://github.com/${REPO}/releases/download/${VERSION}/${BINARY}.tar.gz
|
32 |
-
fi
|
33 |
-
|
34 |
-
printf "This script will automatically download and install Pixi (${VERSION}) for you.\nGetting it from this url: $DOWNLOAD_URL\nThe binary will be installed into '$BIN_DIR'\n"
|
35 |
-
|
36 |
-
if ! hash curl 2> /dev/null && ! hash wget 2> /dev/null; then
|
37 |
-
echo "error: you need either 'curl' or 'wget' installed for this script."
|
38 |
-
exit 1
|
39 |
-
fi
|
40 |
-
|
41 |
-
if ! hash tar 2> /dev/null; then
|
42 |
-
echo "error: you do not have 'tar' installed which is required for this script."
|
43 |
-
exit 1
|
44 |
-
fi
|
45 |
-
|
46 |
-
TEMP_FILE=$(mktemp "${TMPDIR:-/tmp}/.pixi_install.XXXXXXXX")
|
47 |
-
|
48 |
-
cleanup() {
|
49 |
-
rm -f "$TEMP_FILE"
|
50 |
-
}
|
51 |
-
|
52 |
-
trap cleanup EXIT
|
53 |
-
|
54 |
-
if hash curl 2> /dev/null; then
|
55 |
-
HTTP_CODE=$(curl -SL --progress-bar "$DOWNLOAD_URL" --output "$TEMP_FILE" --write-out "%{http_code}")
|
56 |
-
if [[ ${HTTP_CODE} -lt 200 || ${HTTP_CODE} -gt 299 ]]; then
|
57 |
-
echo "error: '${DOWNLOAD_URL}' is not available"
|
58 |
-
exit 1
|
59 |
-
fi
|
60 |
-
elif hash wget 2> /dev/null; then
|
61 |
-
if ! wget -q --show-progress --output-document="$TEMP_FILE" "$DOWNLOAD_URL"; then
|
62 |
-
echo "error: '${DOWNLOAD_URL}' is not available"
|
63 |
-
exit 1
|
64 |
-
fi
|
65 |
-
fi
|
66 |
-
|
67 |
-
# Check that file was correctly created (https://github.com/prefix-dev/pixi/issues/446)
|
68 |
-
if [[ ! -s $TEMP_FILE ]]; then
|
69 |
-
echo "error: temporary file ${TEMP_FILE} not correctly created."
|
70 |
-
echo " As a workaround, you can try set TMPDIR env variable to directory with write permissions."
|
71 |
-
exit 1
|
72 |
-
fi
|
73 |
-
|
74 |
-
# Extract pixi from the downloaded tar file
|
75 |
-
mkdir -p "$BIN_DIR"
|
76 |
-
tar -xzf "$TEMP_FILE" -C "$BIN_DIR"
|
77 |
-
|
78 |
-
update_shell() {
|
79 |
-
FILE=$1
|
80 |
-
LINE=$2
|
81 |
-
|
82 |
-
# shell update can be suppressed by `PIXI_NO_PATH_UPDATE` env var
|
83 |
-
[[ ! -z "${PIXI_NO_PATH_UPDATE-}" ]] && echo "No path update because PIXI_NO_PATH_UPDATE has a value" && return
|
84 |
-
|
85 |
-
# Create the file if it doesn't exist
|
86 |
-
if [ -f "$FILE" ]; then
|
87 |
-
touch "$FILE"
|
88 |
-
fi
|
89 |
-
|
90 |
-
# Append the line if not already present
|
91 |
-
if ! grep -Fxq "$LINE" "$FILE"
|
92 |
-
then
|
93 |
-
echo "Updating '${FILE}'"
|
94 |
-
echo "$LINE" >> "$FILE"
|
95 |
-
fi
|
96 |
-
}
|
97 |
-
case "$(basename "$SHELL")" in
|
98 |
-
bash)
|
99 |
-
if [ -f ~/.bash_profile ]; then
|
100 |
-
BASH_FILE=~/.bash_profile
|
101 |
-
else
|
102 |
-
# Default to bashrc as that is used in non login shells instead of the profile.
|
103 |
-
BASH_FILE=~/.bashrc
|
104 |
-
fi
|
105 |
-
LINE="export PATH=\$PATH:${BIN_DIR}"
|
106 |
-
update_shell $BASH_FILE "$LINE"
|
107 |
-
;;
|
108 |
-
|
109 |
-
fish)
|
110 |
-
LINE="fish_add_path ${BIN_DIR}"
|
111 |
-
update_shell ~/.config/fish/config.fish "$LINE"
|
112 |
-
;;
|
113 |
-
|
114 |
-
zsh)
|
115 |
-
LINE="export PATH=\$PATH:${BIN_DIR}"
|
116 |
-
update_shell ~/.zshrc "$LINE"
|
117 |
-
;;
|
118 |
-
|
119 |
-
*)
|
120 |
-
echo "Unsupported shell: $(basename "$0")"
|
121 |
-
;;
|
122 |
-
esac
|
123 |
-
|
124 |
-
chmod +x "$BIN_DIR/pixi"
|
125 |
-
|
126 |
-
echo "Please restart or source your shell."
|
127 |
-
|
128 |
-
}; __wrap__
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pup
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
|
2 |
VERSION="pup v0 @ Apr 1 2024"
|
3 |
|
4 |
|
@@ -8,7 +8,7 @@ VERSION="pup v0 @ Apr 1 2024"
|
|
8 |
|
9 |
LOG=.woof.log
|
10 |
PIXI_DEFAULT_TASK="jupyter notebook --ip=0.0.0.0 --port=8880"
|
11 |
-
SYMLINK_ON_PATH
|
12 |
USAGE_MAIN="\n
|
13 |
\e[1m\e[4mUsage\e[0m: (each subcommand shows more help)\n
|
14 |
\e[0;33mpup\e[0m\n
|
@@ -71,7 +71,9 @@ if [ -z "$1" ]; then
|
|
71 |
# link
|
72 |
SYMLINK_CURRENT=$(readlink -f "$SYMLINK_ON_PATH")
|
73 |
if [ "$SYMLINK_CURRENT" != "$(pwd)/pup" ] && [ -f "./pup" ]; then
|
74 |
-
|
|
|
|
|
75 |
ln -s -f "$(pwd)"/pup $SYMLINK_ON_PATH
|
76 |
fi
|
77 |
log_command "$0 $*"
|
@@ -218,11 +220,9 @@ if [ "$1" == "pixi" ]; then
|
|
218 |
if [ "$2" == "init" ]; then
|
219 |
# install and init Pixi project in pup's home dir
|
220 |
if ! command -v pixi &> /dev/null; then
|
|
|
221 |
curl -fsSL https://pixi.sh/install.sh | bash
|
222 |
-
|
223 |
-
# chmod +x ./pixi_install.sh
|
224 |
-
# sh -c ./pixi_install.sh
|
225 |
-
ls -l
|
226 |
fi
|
227 |
PUPHOME=$(pup home)
|
228 |
if [[ ! -f "$PUPHOME"/pixi.toml ]]; then
|
|
|
1 |
+
#!/usr/bin/env bash
|
2 |
VERSION="pup v0 @ Apr 1 2024"
|
3 |
|
4 |
|
|
|
8 |
|
9 |
LOG=.woof.log
|
10 |
PIXI_DEFAULT_TASK="jupyter notebook --ip=0.0.0.0 --port=8880"
|
11 |
+
SYMLINK_ON_PATH=$HOME/.local/bin/pup
|
12 |
USAGE_MAIN="\n
|
13 |
\e[1m\e[4mUsage\e[0m: (each subcommand shows more help)\n
|
14 |
\e[0;33mpup\e[0m\n
|
|
|
71 |
# link
|
72 |
SYMLINK_CURRENT=$(readlink -f "$SYMLINK_ON_PATH")
|
73 |
if [ "$SYMLINK_CURRENT" != "$(pwd)/pup" ] && [ -f "./pup" ]; then
|
74 |
+
SYMLINK_PATH_FOLDER=${SYMLINK_ON_PATH%/*}
|
75 |
+
mkdir -p "$SYMLINK_PATH_FOLDER"
|
76 |
+
# echo $SYMLINK_PATH_FOLDER
|
77 |
ln -s -f "$(pwd)"/pup $SYMLINK_ON_PATH
|
78 |
fi
|
79 |
log_command "$0 $*"
|
|
|
220 |
if [ "$2" == "init" ]; then
|
221 |
# install and init Pixi project in pup's home dir
|
222 |
if ! command -v pixi &> /dev/null; then
|
223 |
+
touch $HOME/.bashrc
|
224 |
curl -fsSL https://pixi.sh/install.sh | bash
|
225 |
+
source $HOME/.bashrc
|
|
|
|
|
|
|
226 |
fi
|
227 |
PUPHOME=$(pup home)
|
228 |
if [[ ! -f "$PUPHOME"/pixi.toml ]]; then
|