Skip to content

Development dockerfile #685

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 3 commits into from
Jun 5, 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
101 changes: 101 additions & 0 deletions Dockerfile.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@

FROM ubuntu:jammy
LABEL maintainer="team@postgresml.com"

ARG PG_MAJOR_VER
ENV PG_MAJOR_VER=${PG_MAJOR_VER}

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-$PG_MAJOR_VER \
postgresql-$PG_MAJOR_VER \
postgresql-server-dev-$PG_MAJOR_VER \
git

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 echo 'postgres ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers


COPY ./pgml-extension/requirements.txt /app/requirements.txt


RUN pip3 install -r /app/requirements.txt


# Running pgrx and tests require a non-root user
WORKDIR /app

RUN chmod a+rwx `$(which pg_config) --pkglibdir` \
`$(which pg_config) --sharedir`/extension \
/var/run/postgresql/

RUN useradd postgresml -m -s /bin/bash -G sudo
RUN echo 'postgresml ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers

USER postgresml


# Install cargo and Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/home/postgresml/.cargo/bin:${PATH}"


# Install pgrx
RUN cargo install cargo-pgrx --version "0.8.2" --locked


COPY --chown=postgresml:postgresml ./ /app
RUN sudo chown -R postgresml:postgresml /app
RUN git submodule update --init --recursive




RUN sudo cp /app/pgml-extension/docker/postgresql.conf /etc/postgresql/$PG_MAJOR_VER/main/postgresql.conf
RUN sudo cp /app/pgml-extension/docker/pg_hba.conf /etc/postgresql/$PG_MAJOR_VER/main/pg_hba.conf


# RUN sudo chown -R rust:rust /usr/share/postgresql/$PG_MAJOR_VER/extension
RUN sudo chown -R postgresml:postgresml /usr/share/postgresql/$PG_MAJOR_VER/
RUN sudo chown -R postgresml:postgresml /usr/share/postgresql/$PG_MAJOR_VER/extension

# commenting this three make things work
# USER rust

RUN cd /app/pgml-extension && cargo pgrx init --pg$PG_MAJOR_VER=$(which pg_config)
RUN cd /app/pgml-extension && cargo pgrx install --pg-config $(which pg_config)

EXPOSE 5432

USER postgres

CMD ["/usr/lib/postgresql/14/bin/postgres", "-c", "config_file=/etc/postgresql/14/main/postgresql.conf"]

15 changes: 15 additions & 0 deletions docker-compose.local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3"
# Run by doing docker compose -f docker-compose.local.yml build --build-arg PG_MAJOR_VER=14
# docker compose -f docker-compose.local.yml up
services:
postgres:
healthcheck:
test: [ "CMD-SHELL", "pg_isready" ]
interval: 1s
timeout: 5s
retries: 100
build:
context: .
dockerfile: Dockerfile.local
ports:
- "5433:5432"
49 changes: 0 additions & 49 deletions pgml-extension/Dockerfile.local

This file was deleted.

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