why `cargo pgrx install` requires `Cargo.toml`
wasdee opened this issue · 2 comments
wasdee commented
# PostGIS, but add ULID extension
ARG PG_MAJOR=15
FROM postgis/postgis:${PG_MAJOR}-3.3
RUN apt update
ENV build_deps ca-certificates \
git \
build-essential \
libpq-dev \
postgresql-server-dev-${PG_MAJOR} \
curl \
libreadline6-dev \
zlib1g-dev
RUN apt-get install -y --no-install-recommends $build_deps pkg-config cmake
WORKDIR /home/postgres
ENV HOME=/home/postgres
ENV PATH=/home/postgres/.cargo/bin:$PATH
RUN chown postgres:postgres /home/postgres
USER postgres
# install rust
RUN \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal --default-toolchain 1.68.0 && \
rustup --version && \
rustc --version && \
cargo --version
# pgrx
RUN cargo install cargo-pgrx --version 0.7.4 --locked
RUN cargo pgrx init --pg${PG_MAJOR} $(which pg_config)
USER root
COPY . .
RUN cargo pgrx install
RUN chown -R postgres:postgres /home/postgres
RUN chown -R postgres:postgres /usr/share/postgresql/${PG_MAJOR}/extension
RUN chown -R postgres:postgres /usr/lib/postgresql/${PG_MAJOR}/lib
USER postgres
ENV POSTGRES_HOST_AUTH_METHOD=trust
ENV USER=postgres
> [10/13] RUN cargo pgrx install:
#14 0.664 Error:
#14 0.664 0: couldn't get cargo metadata
#14 0.664 1: `cargo metadata` exited with an error: error: could not find `Cargo.toml` in `/home/postgres` or any parent directory
#14 0.664
#14 0.664
#14 0.664 Location:
#14 0.664 /home/postgres/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-pgrx-0.7.4/src/metadata.rs:23
#14 0.664
#14 0.664 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SPANTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#14 0.664
#14 0.664 0: cargo_pgrx::command::install::execute
#14 0.664 at /home/postgres/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-pgrx-0.7.4/src/command/install.rs:51
#14 0.664
#14 0.664 Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
#14 0.664 Run with RUST_BACKTRACE=full to include source snippets.
pksunkara commented
Because that actually compiles the code and creates a postgres extension. But I guess, the question is more for https://github.com/tcdi/pgrx.
I would suggest using the deb files at https://github.com/pksunkara/pgx_ulid/releases/tag/v0.1.0 though.
wasdee commented
here is the edit for deb installation. @pksunkara thank you
RUN curl -OJL https://github.com/pksunkara/pgx_ulid/releases/download/v0.1.0/pgx_ulid-v0.1.0-pg15-amd64-linux-gnu.deb && \
apt install ./pgx_ulid-v0.1.0-pg15-amd64-linux-gnu.deb