File tree 4 files changed +75
-5
lines changed
container-images/pragmatic
4 files changed +75
-5
lines changed Original file line number Diff line number Diff line change 69
69
70
70
- name : Build Images
71
71
run : |
72
- make build_rm
72
+ make build-rm
Original file line number Diff line number Diff line change @@ -7,18 +7,27 @@ SHAREDIR ?= ${PREFIX}/share
7
7
PYTHON ?= $(shell command -v python3 python|head -n1)
8
8
DESTDIR ?= /
9
9
PATH := $(PATH ) :$(HOME ) /.local/bin
10
-
10
+ IMAGE ?= ramalama
11
+ GPU ?= cpu
11
12
12
13
default : help
13
14
14
15
help :
15
- @echo " Build Container"
16
+ @echo " Build Container Image "
16
17
@echo
17
18
@echo " - make build"
18
19
@echo " - make build IMAGE=ramalama"
19
20
@echo " - make multi-arch"
20
21
@echo " - make multi-arch IMAGE=ramalama"
21
22
@echo
23
+ @echo " Build RAG Container Image"
24
+ @echo
25
+ @echo " - make build-rag IMAGE=quay.io/ramalama/ramalama GPU=ramalama"
26
+ @echo
27
+ @echo " Build Docling Container Image"
28
+ @echo
29
+ @echo " - make build-docling IMAGE=quay.io/ramalama/ramalama GPU=ramalama"
30
+ @echo
22
31
@echo " Build docs"
23
32
@echo
24
33
@echo " - make docs"
@@ -79,14 +88,22 @@ install: docs completions
79
88
build :
80
89
./container_build.sh build $(IMAGE )
81
90
82
- .PHONY : build_rm
83
- build_rm :
91
+ .PHONY : build-rm
92
+ build-rm :
84
93
./container_build.sh -r build $(IMAGE )
85
94
86
95
.PHONY : build_multi_arch
87
96
build_multi_arch :
88
97
./container_build.sh multi-arch $(IMAGE )
89
98
99
+ .PHONY : build-rag
100
+ build-rag :
101
+ podman build --build-arg IMAGE=${IMAGE} --build-arg GPU=${GPU} -t ${IMAGE} -rag container-images/pragmatic
102
+
103
+ .PHONY : build-docling
104
+ build-docling :
105
+ podman build --build-arg IMAGE=${IMAGE} --build-arg CONTENT=docling --build-arg GPU=${GPU} -t ${IMAGE} -docling container-images/pragmatic
106
+
90
107
.PHONY : install-docs
91
108
install-docs : docs
92
109
make -C docs install
Original file line number Diff line number Diff line change
1
+ ARG IMAGE=quay.io/ramalama/ramalama:latest
2
+ FROM $IMAGE
3
+
4
+ ARG GPU=cpu
5
+ ARG CONTENT=rag
6
+ COPY ./build_pragmatic.sh /tmp/
7
+ RUN echo $CONTENT
8
+ RUN sh /tmp/build_pragmatic.sh ${GPU} ${CONTENT}
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -exu -o pipefail
4
+
5
+ export PYTHON_VERSION=" python3 -m"
6
+ if [ " $( python3 --version) " \< " Python 3.11" ]; then
7
+ dnf install -y python3.11 python3.11-pip git
8
+ export PYTHON_VERSION=" /usr/bin/python3.11 -m"
9
+ else
10
+ dnf install -y python3-pip git
11
+ fi
12
+
13
+ cuda=" cu124"
14
+
15
+ rocm=" rocm6.2"
16
+
17
+ cpu=" cpu"
18
+
19
+ vulkan=$cpu
20
+
21
+ asahi=$cpu
22
+
23
+ install_pytorch () {
24
+ version=${! 1}
25
+ echo ${PYTHON_VERSION} pip install torch==${version} -f https://download.pytorch.org/whl/torch_stable.html
26
+ ${PYTHON_VERSION} pip install torch==${version} -f https://download.pytorch.org/whl/torch_stable.html
27
+ }
28
+
29
+ clone_and_build_pragmatic () {
30
+ if [ " $2 " == " docling" ]; then
31
+ ${PYTHON_VERSION} pip install docling --extra-index-url https://download.pytorch.org/whl/$1
32
+ fi
33
+ git clone https://github.com/redhat-et/PRAGmatic
34
+ cd PRAGmatic
35
+ git submodule update --init --recursive
36
+
37
+ ${PYTHON_VERSION} pip install -r requirements.txt --prefix=/usr
38
+ ${PYTHON_VERSION} pip install --prefix=/usr .
39
+ cd ..
40
+ }
41
+
42
+ clone_and_build_pragmatic ${! 1} $2
43
+ rm -rf /var/cache/* dnf* /opt/rocm-* /lib/* /library/* gfx9* /root/.cache /root/buildinfo PRAGmatic
44
+ dnf -y clean all
45
+ ldconfig
You can’t perform that action at this time.
0 commit comments