File tree 4 files changed +86
-1
lines changed
4 files changed +86
-1
lines changed Original file line number Diff line number Diff line change
1
+ FROM ubuntu:latest
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+ ENV PATH=/usr/local/CodeFlare/bin:$PATH
5
+
6
+ # TODO hard-coded arch
7
+ ADD dist/electron/CodeFlare-linux-x64 /usr/local/CodeFlare
8
+
9
+ # Note, the `codeflare ...` commands are not strictly necessary. We do
10
+ # them here only to save some time installing these prereqs on every
11
+ # run.
12
+ RUN apt update && apt -y install python3 python3-pip \
13
+ && apt -y clean && rm -rf /var/lib/apt/lists/* \
14
+ && codeflare util/jq \
15
+ && codeflare util/websocat \
16
+ && codeflare s3/install/cli \
17
+ && codeflare ml/ray/install/cli \
18
+ && codeflare kubernetes/kubectl \
19
+ && codeflare kubernetes/helm3 \
20
+ && adduser --disabled-password --gecos '' codeflare && adduser codeflare sudo && adduser root sudo && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
21
+ && touch /home/codeflare/.codeflare
22
+
23
+ ENTRYPOINT ["codeflare" ]
24
+ WORKDIR /home/codeflare
25
+ USER codeflare
26
+
27
+
28
+
29
+
30
+ # in case we want to use the published production versions at some point...
31
+ # RUN export FILE=CodeFlare-linux-$([ "$(uname -m)" = "x86_64" ] && echo x64 || echo arm64) \
32
+ # && apt update && apt -y install bash \
33
+ # && curl -LO https://github.com/project-codeflare/codeflare-cli/releases/latest/download/$FILE.zip \
34
+ # && unzip $FILE.zip \
35
+ # && apt -y remove curl unzip && apt -y clean && rm -rf /var/lib/apt/lists/* \
36
+ # && rm $FILE.zip \
37
+ # && mv $FILE /usr/local/CodeFlare
38
+
Original file line number Diff line number Diff line change @@ -17,6 +17,41 @@ brew tap project-codeflare/codeflare-cli https://github.com/project-codeflare/co
17
17
brew install codeflare
18
18
```
19
19
20
+ ## Development
21
+
22
+ For codeflare-cli developers:
23
+
24
+ ``` shell
25
+ git clone https://github.com/project-codeflare/codeflare-cli
26
+ cd codeflare-cli
27
+ npm ci
28
+ npm run watch
29
+ ```
30
+
31
+ Now you may use ` ./bin/codeflare ` to launch your local clone. The
32
+ watcher will recompile things when you make changes to TypeScript or
33
+ SCSS source files.
34
+
35
+ ### Docker
36
+
37
+ If you want to build a Docker image, this command will build a
38
+ production client (which takes around 30 seconds), and then build the
39
+ Docker image (which takes another few minutes).
40
+
41
+ ``` shell
42
+ npm run build:docker
43
+ ```
44
+
45
+ If you want to skip the first step, and only test building the Docker
46
+ image, use ` build:docker0 ` .
47
+
48
+ To test your image, try ` ./bin/codeflare -d ` . If you want to debug the
49
+ image itself, use ` npm run docker:debug ` which will get you a shell
50
+ into a running container.
51
+
52
+ Limitations: the Docker build scripts are currently hard-wired to
53
+ x86. PRs welcome to leverage ` docker buildx ` to build for ARM, etc.
54
+
20
55
## License
21
56
22
57
CodeFlare CLI is an open-source project with an [ Apache 2.0 license] ( LICENSE ) .
Original file line number Diff line number Diff line change 110
110
# check if the user wants us to run the graphical version (currently
111
111
# indicated by the -u option)
112
112
do_cli=1
113
- while getopts " nVus:" opt
113
+ use_docker=0
114
+ while getopts " dnVus:" opt
114
115
do
115
116
case $opt in
117
+ d) use_docker=1; continue ;;
116
118
u) do_cli=0; continue ;;
117
119
s) GUIDEBOOK_STORE=$OPTARG ; continue ;;
118
120
* ) EXTRAPREFIX=" $EXTRAPREFIX -$opt " ; continue ;;
119
121
esac
120
122
done
121
123
shift $(( OPTIND- 1 ))
122
124
125
+ if [ $use_docker = 1 ]; then
126
+ exec docker run -it --entrypoint ${ENTRYPOINT-codeflare} --rm -v /tmp:/tmp -v ~ /.aws:/home/codeflare/.aws -v ~ /.bluemix:/home/codeflare/.bluemix -v ~ /.kube:/home/codeflare/.kube -e KUBECONFIG=$( echo $KUBECONFIG | sed " s/$USER /codeflare/g" | sed ' s/Users/home/g' ) projectcodeflare/codeflare-cli
127
+ fi
128
+
123
129
if ([ $do_cli = 1 ] && [ $# = 0 ]) || ([ $# = 1 ] && [ " $1 " != " version" ]); then
124
130
# use the "guide" command if none was given
125
131
EXTRAPREFIX=" $EXTRAPREFIX guide"
@@ -164,5 +170,8 @@ if [ ! -f ~/.codeflare ] && [ $(uname) = Linux ]; then
164
170
fi
165
171
fi
166
172
173
+ # helps with ctrl+c when running in a docker container
174
+ trap ' pkill -P $$; exit 1;' TERM INT
175
+
167
176
# otherwise, we launch the UI version
168
177
" $NODE " " $HEADLESS " /codeflare.min.js -- $EXTRAPREFIX $*
Original file line number Diff line number Diff line change 19
19
"pty:nodejs" : " npm run pty:rebuild node" ,
20
20
"prepare" : " cross-env husky install" ,
21
21
"preprod" : " npm run mirror" ,
22
+ "build:docker0" : " docker build -t projectcodeflare/codeflare-cli ." ,
23
+ "build:docker" : " NO_INSTALLER=true npm run build:electron:linux:amd64 && npm run build:docker0" ,
24
+ "docker:debug" : " ENTRYPOINT=bash ./bin/codeflare -d" ,
22
25
"build:electron:mac:amd64" : " npm run preprod && KUI_HEADLESS_WEBPACK=true KUI_LAUNCHER=$PWD/bin/codeflare PLATFORM=mac ARCH=x64 kui-build-electron" ,
23
26
"build:electron:mac:arm64" : " npm run preprod && KUI_HEADLESS_WEBPACK=true KUI_LAUNCHER=$PWD/bin/codeflare PLATFORM=mac ARCH=arm64 kui-build-electron" ,
24
27
"build:electron:osx:amd64" : " npm run preprod && KUI_HEADLESS_WEBPACK=true KUI_LAUNCHER=$PWD/bin/codeflare npm run build:electron:mac:amd64" ,
You can’t perform that action at this time.
0 commit comments