Skip to content

Commit b872694

Browse files
montanalowjas8dz
andauthored
git add cuda support to docker that works with wsl (#681)
Co-authored-by: jas8dz <jsaied@mail.missouri.edu>
1 parent 03f0499 commit b872694

File tree

4 files changed

+120
-64
lines changed

4 files changed

+120
-64
lines changed

docker-compose.cuda.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
version: "3"
2+
services:
3+
postgres:
4+
deploy:
5+
resources:
6+
reservations:
7+
devices:
8+
- driver: nvidia
9+
count: 1
10+
capabilities: [ gpu ]
11+
healthcheck:
12+
test: [ "CMD-SHELL", "pg_isready" ]
13+
interval: 1s
14+
timeout: 5s
15+
retries: 100
16+
build:
17+
context: ./pgml-extension/
18+
dockerfile: Dockerfile
19+
ports:
20+
- "5433:5432"
21+
command:
22+
- sleep
23+
- infinity
24+
dashboard:
25+
depends_on:
26+
postgres:
27+
condition: service_healthy
28+
build:
29+
context: ./pgml-dashboard/
30+
dockerfile: Dockerfile
31+
ports:
32+
- "8000:8000"
33+
environment:
34+
ROCKET_ADDRESS: 0.0.0.0
35+
DATABASE_URL: postgres://postgres:postgres@postgres:5432/pgml_development
36+
command: bash -c "sqlx migrate run && cargo run"
37+
docs:
38+
build:
39+
context: ./pgml-docs/
40+
dockerfile: Dockerfile
41+
ports:
42+
- "8001:8001"
43+
command:
44+
- mkdocs
45+
- serve
46+
- -a 0.0.0.0:8001

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
retries: 100
99
build:
1010
context: ./pgml-extension/
11-
dockerfile: Dockerfile.local
11+
dockerfile: Dockerfile
1212
ports:
1313
- "5433:5432"
1414
command:

pgml-extension/Dockerfile

Lines changed: 33 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,38 @@
1-
FROM ubuntu:jammy
2-
MAINTAINER team@postgresml.com
1+
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
2+
LABEL maintainer="team@postgresml.com"
3+
34
RUN apt-get update
45
ARG DEBIAN_FRONTEND=noninteractive
56
ENV TZ=Etc/UTC
6-
RUN apt-get install -y software-properties-common
7-
RUN add-apt-repository ppa:apt-fast/stable --yes
8-
RUN apt update && apt-get install -y apt-fast
9-
RUN apt-get update && apt-fast install -y \
10-
libopenblas-dev \
11-
libssl-dev \
12-
bison \
13-
flex \
14-
pkg-config \
15-
cmake \
16-
libreadline-dev \
17-
libz-dev \
18-
curl \
19-
lsb-release \
20-
tzdata \
21-
sudo \
22-
cmake \
23-
libpq-dev \
24-
libclang-dev \
25-
wget \
26-
postgresql-plpython3-14 \
27-
postgresql-14 \
28-
postgresql-server-dev-14
29-
RUN add-apt-repository ppa:deadsnakes/ppa --yes
30-
RUN apt update && apt-fast install -y \
31-
python3.10 \
32-
python3-pip \
33-
libpython3.10-dev \
34-
python3.10-dev
35-
RUN useradd postgresml -m -s /bin/bash -G sudo
36-
RUN echo 'postgresml ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
37-
USER postgresml
38-
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
39-
RUN $HOME/.cargo/bin/cargo install cargo-pgrx --version "0.8.2" --locked
40-
RUN $HOME/.cargo/bin/cargo pgrx init
41-
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null
42-
RUN sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
43-
RUN sudo apt update
44-
RUN sudo apt-get install -y postgresql-15 postgresql-13 postgresql-12 postgresql-11
45-
RUN sudo apt install -y postgresql-server-dev-15 postgresql-server-dev-15 postgresql-server-dev-12 postgresql-server-dev-11
7+
ENV PATH="/usr/local/cuda/bin:${PATH}"
8+
9+
RUN apt-get update && apt-get install -y curl lsb-release python3 python3-pip tzdata sudo cmake libpq-dev libclang-dev wget git
10+
11+
RUN apt-get update && \
12+
apt-get install -y wget gnupg lsb-release && \
13+
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
14+
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
15+
apt-get update && \
16+
apt-get install -y postgresql-14 && \
17+
apt-get install -y postgresql-plpython3-14
18+
19+
20+
RUN echo "deb [trusted=yes] https://apt.postgresml.org $(lsb_release -cs) main" >> /etc/apt/sources.list
21+
RUN cat /etc/apt/sources.list
22+
RUN apt-get update && apt-get install -y postgresql-pgml-14
23+
# Cache this, quicker
24+
COPY --chown=postgres:postgres . /app
4625
WORKDIR /app
4726
RUN pip3 install -r requirements.txt
27+
# Listen on 0.0.0.0 and allow 'root' to connect without a password.
28+
# Please modify for production deployments accordingly.
29+
RUN cp /app/docker/postgresql.conf /etc/postgresql/14/main/postgresql.conf
30+
RUN cp /app/docker/pg_hba.conf /etc/postgresql/14/main/pg_hba.conf
31+
RUN cd /tmp && \
32+
git clone --branch v0.4.1 https://github.com/pgvector/pgvector.git && \
33+
cd pgvector && \
34+
make && \
35+
make install
36+
37+
WORKDIR /app
38+
ENTRYPOINT ["/bin/bash", "/app/docker/entrypoint.sh"]

pgml-extension/Dockerfile.local

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,49 @@
11
FROM ubuntu:jammy
22
MAINTAINER team@postgresml.com
3-
43
RUN apt-get update
54
ARG DEBIAN_FRONTEND=noninteractive
65
ENV TZ=Etc/UTC
7-
RUN apt-get update && apt-get install -y curl lsb-release python3 python3-pip tzdata sudo cmake libpq-dev libclang-dev wget postgresql-plpython3-14 postgresql-14 git
8-
9-
RUN echo "deb [trusted=yes] https://apt.postgresml.org $(lsb_release -cs) main" >> /etc/apt/sources.list
10-
RUN cat /etc/apt/sources.list
11-
RUN apt-get update && apt-get install -y postgresql-pgml-14
12-
13-
# Cache this, quicker
14-
COPY --chown=postgres:postgres . /app
6+
RUN apt-get install -y software-properties-common
7+
RUN add-apt-repository ppa:apt-fast/stable --yes
8+
RUN apt update && apt-get install -y apt-fast
9+
RUN apt-get update && apt-fast install -y \
10+
libopenblas-dev \
11+
libssl-dev \
12+
bison \
13+
flex \
14+
pkg-config \
15+
cmake \
16+
libreadline-dev \
17+
libz-dev \
18+
curl \
19+
lsb-release \
20+
tzdata \
21+
sudo \
22+
cmake \
23+
libpq-dev \
24+
libclang-dev \
25+
wget \
26+
postgresql-plpython3-14 \
27+
postgresql-14 \
28+
postgresql-server-dev-14
29+
RUN add-apt-repository ppa:deadsnakes/ppa --yes
30+
RUN apt update && apt-fast install -y \
31+
python3.10 \
32+
python3-pip \
33+
libpython3.10-dev \
34+
python3.10-dev
35+
RUN useradd postgresml -m -s /bin/bash -G sudo
36+
RUN echo 'postgresml ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
37+
USER postgresml
38+
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
39+
RUN $HOME/.cargo/bin/cargo install cargo-pgrx --version "0.8.2" --locked
40+
RUN $HOME/.cargo/bin/cargo pgrx init
41+
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null
42+
RUN sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
43+
RUN sudo apt update
44+
RUN sudo apt-get install -y postgresql-15 postgresql-13 postgresql-12 postgresql-11
45+
RUN sudo apt install -y postgresql-server-dev-15 postgresql-server-dev-15 postgresql-server-dev-12 postgresql-server-dev-11
1546
WORKDIR /app
1647
RUN pip3 install -r requirements.txt
1748

18-
# Listen on 0.0.0.0 and allow 'root' to connect without a password.
19-
# Please modify for production deployments accordingly.
20-
RUN cp /app/docker/postgresql.conf /etc/postgresql/14/main/postgresql.conf
21-
RUN cp /app/docker/pg_hba.conf /etc/postgresql/14/main/pg_hba.conf
2249

23-
RUN cd /tmp && \
24-
git clone --branch v0.4.1 https://github.com/pgvector/pgvector.git && \
25-
cd pgvector && \
26-
make && \
27-
make install
28-
29-
WORKDIR /app
30-
ENTRYPOINT ["/bin/bash", "/app/docker/entrypoint.sh"]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy