Skip to content

git add cuda support to docker that works with wsl #681

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions docker-compose.cuda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: "3"
services:
postgres:
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [ gpu ]
healthcheck:
test: [ "CMD-SHELL", "pg_isready" ]
interval: 1s
timeout: 5s
retries: 100
build:
context: ./pgml-extension/
dockerfile: Dockerfile
ports:
- "5433:5432"
command:
- sleep
- infinity
dashboard:
depends_on:
postgres:
condition: service_healthy
build:
context: ./pgml-dashboard/
dockerfile: Dockerfile
ports:
- "8000:8000"
environment:
ROCKET_ADDRESS: 0.0.0.0
DATABASE_URL: postgres://postgres:postgres@postgres:5432/pgml_development
command: bash -c "sqlx migrate run && cargo run"
docs:
build:
context: ./pgml-docs/
dockerfile: Dockerfile
ports:
- "8001:8001"
command:
- mkdocs
- serve
- -a 0.0.0.0:8001
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
retries: 100
build:
context: ./pgml-extension/
dockerfile: Dockerfile.local
dockerfile: Dockerfile
ports:
- "5433:5432"
command:
Expand Down
75 changes: 33 additions & 42 deletions pgml-extension/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,38 @@
FROM ubuntu:jammy
MAINTAINER team@postgresml.com
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
LABEL maintainer="team@postgresml.com"

RUN apt-get update
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:apt-fast/stable --yes
RUN apt update && apt-get install -y apt-fast
RUN apt-get update && apt-fast install -y \
libopenblas-dev \
libssl-dev \
bison \
flex \
pkg-config \
cmake \
libreadline-dev \
libz-dev \
curl \
lsb-release \
tzdata \
sudo \
cmake \
libpq-dev \
libclang-dev \
wget \
postgresql-plpython3-14 \
postgresql-14 \
postgresql-server-dev-14
RUN add-apt-repository ppa:deadsnakes/ppa --yes
RUN apt update && apt-fast install -y \
python3.10 \
python3-pip \
libpython3.10-dev \
python3.10-dev
RUN useradd postgresml -m -s /bin/bash -G sudo
RUN echo 'postgresml ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
USER postgresml
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
RUN $HOME/.cargo/bin/cargo install cargo-pgrx --version "0.8.2" --locked
RUN $HOME/.cargo/bin/cargo pgrx init
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
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'
RUN sudo apt update
RUN sudo apt-get install -y postgresql-15 postgresql-13 postgresql-12 postgresql-11
RUN sudo apt install -y postgresql-server-dev-15 postgresql-server-dev-15 postgresql-server-dev-12 postgresql-server-dev-11
ENV PATH="/usr/local/cuda/bin:${PATH}"

RUN apt-get update && apt-get install -y curl lsb-release python3 python3-pip tzdata sudo cmake libpq-dev libclang-dev wget git

RUN apt-get update && \
apt-get install -y wget gnupg lsb-release && \
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
apt-get update && \
apt-get install -y postgresql-14 && \
apt-get install -y postgresql-plpython3-14


RUN echo "deb [trusted=yes] https://apt.postgresml.org $(lsb_release -cs) main" >> /etc/apt/sources.list
RUN cat /etc/apt/sources.list
RUN apt-get update && apt-get install -y postgresql-pgml-14
# Cache this, quicker
COPY --chown=postgres:postgres . /app
WORKDIR /app
RUN pip3 install -r requirements.txt
# Listen on 0.0.0.0 and allow 'root' to connect without a password.
# Please modify for production deployments accordingly.
RUN cp /app/docker/postgresql.conf /etc/postgresql/14/main/postgresql.conf
RUN cp /app/docker/pg_hba.conf /etc/postgresql/14/main/pg_hba.conf
RUN cd /tmp && \
git clone --branch v0.4.1 https://github.com/pgvector/pgvector.git && \
cd pgvector && \
make && \
make install

WORKDIR /app
ENTRYPOINT ["/bin/bash", "/app/docker/entrypoint.sh"]
61 changes: 40 additions & 21 deletions pgml-extension/Dockerfile.local
Original file line number Diff line number Diff line change
@@ -1,30 +1,49 @@
FROM ubuntu:jammy
MAINTAINER team@postgresml.com

RUN apt-get update
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
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

RUN echo "deb [trusted=yes] https://apt.postgresml.org $(lsb_release -cs) main" >> /etc/apt/sources.list
RUN cat /etc/apt/sources.list
RUN apt-get update && apt-get install -y postgresql-pgml-14

# Cache this, quicker
COPY --chown=postgres:postgres . /app
RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:apt-fast/stable --yes
RUN apt update && apt-get install -y apt-fast
RUN apt-get update && apt-fast install -y \
libopenblas-dev \
libssl-dev \
bison \
flex \
pkg-config \
cmake \
libreadline-dev \
libz-dev \
curl \
lsb-release \
tzdata \
sudo \
cmake \
libpq-dev \
libclang-dev \
wget \
postgresql-plpython3-14 \
postgresql-14 \
postgresql-server-dev-14
RUN add-apt-repository ppa:deadsnakes/ppa --yes
RUN apt update && apt-fast install -y \
python3.10 \
python3-pip \
libpython3.10-dev \
python3.10-dev
RUN useradd postgresml -m -s /bin/bash -G sudo
RUN echo 'postgresml ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
USER postgresml
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
RUN $HOME/.cargo/bin/cargo install cargo-pgrx --version "0.8.2" --locked
RUN $HOME/.cargo/bin/cargo pgrx init
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
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'
RUN sudo apt update
RUN sudo apt-get install -y postgresql-15 postgresql-13 postgresql-12 postgresql-11
RUN sudo apt install -y postgresql-server-dev-15 postgresql-server-dev-15 postgresql-server-dev-12 postgresql-server-dev-11
WORKDIR /app
RUN pip3 install -r requirements.txt

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

RUN cd /tmp && \
git clone --branch v0.4.1 https://github.com/pgvector/pgvector.git && \
cd pgvector && \
make && \
make install

WORKDIR /app
ENTRYPOINT ["/bin/bash", "/app/docker/entrypoint.sh"]
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