From 3e6b6638d13094b0fa00806aeab92b84a9ed1dde Mon Sep 17 00:00:00 2001 From: Adam Hendel Date: Wed, 5 Jun 2024 21:34:44 -0500 Subject: [PATCH] Fix docker build (#55) * fix build --- .dockerignore | 1 + .github/workflows/pg_later_ext.yml | 17 +++++++++-------- README.md | 6 +++++- images/pglater-pg/Dockerfile | 3 ++- 4 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..1de5659 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +target \ No newline at end of file diff --git a/.github/workflows/pg_later_ext.yml b/.github/workflows/pg_later_ext.yml index a4e154e..cc22726 100644 --- a/.github/workflows/pg_later_ext.yml +++ b/.github/workflows/pg_later_ext.yml @@ -128,7 +128,7 @@ jobs: ls -alh ~/.pgrx publish: - if: startsWith(github.ref, 'refs/tags/') + if: github.event_name == 'release' name: trunk publish needs: dependencies runs-on: ubuntu-22.04 @@ -160,20 +160,21 @@ jobs: ${{ runner.os }}-bins- - name: trunk build working-directory: ./ - run: ~/.cargo/bin/trunk build --pg-version ${{ matrix.pg-version }} + run: | + cargo install pg-trunk --force + ~/.cargo/bin/trunk --version + ~/.cargo/bin/trunk build --pg-version ${{ matrix.pg-version }} - name: trunk publish working-directory: ./ env: TRUNK_API_TOKEN: ${{ secrets.TRUNK_AUTH_TOKEN }} run: ~/.cargo/bin/trunk publish build_and_push: + if: github.event_name == 'release' name: Build and push images needs: - - publish - runs-on: - - self-hosted - - dind - - large-8x8 + - dependencies + runs-on: ubuntu-22.04 outputs: short_sha: ${{ steps.versions.outputs.SHORT_SHA }} steps: @@ -195,7 +196,7 @@ jobs: echo "PGRX_VER=$(/usr/local/bin/stoml Cargo.toml dependencies.pgrx)" >> $GITHUB_OUTPUT - name: Build and upload image run: | - docker build --build-arg="PGRX_VER=${{ steps.versions.outputs.PGRX_VER }}" -t pglater-pg images/pglater-pg + docker build --build-arg="PGRX_VER=${{ steps.versions.outputs.PGRX_VER }}" -t pglater-pg -f images/pglater-pg/Dockerfile . docker tag pglater-pg quay.io/tembo/pglater-pg:v${{ steps.versions.outputs.TAG_VER }} docker tag pglater-pg quay.io/tembo/pglater-pg:latest - name: Login to Quay diff --git a/README.md b/README.md index 6b05fe3..8cd2834 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # pg_later + Execute SQL now and get the results later. A postgres extension to execute queries asynchronously. Built on [pgmq](https://github.com/tembo-io/pgmq). @@ -18,7 +19,6 @@ docker run -p 5432:5432 -e POSTGRES_PASSWORD=postgres quay.io/tembo/pglater-pg:l If you'd like to build from source, you can follow the instructions in [CONTRIBUTING.md](https://github.com/tembo-io/pg_later/blob/main/CONTRIBUTING.md). - ### Using the extension Initialize the extension's backend: @@ -35,7 +35,9 @@ Execute a SQL query now: select pglater.exec( 'select * from pg_available_extensions order by name limit 2' ) as job_id; +``` +```text job_id -------- 1 @@ -46,7 +48,9 @@ Come back at some later time, and retrieve the results by providing the job id: ```sql select pglater.fetch_results(1); +``` +```text pg_later_results -------------------- { diff --git a/images/pglater-pg/Dockerfile b/images/pglater-pg/Dockerfile index 609751f..527dddb 100644 --- a/images/pglater-pg/Dockerfile +++ b/images/pglater-pg/Dockerfile @@ -10,7 +10,7 @@ RUN apt-get update \ libssl-dev \ make \ pkg-config \ - postgresql-server-dev-15 + postgresql-server-dev-16 # install pgmq RUN git clone https://github.com/tembo-io/pgmq.git && \ @@ -26,6 +26,7 @@ RUN $HOME/.cargo/bin/rustup default stable # install pgrx ARG PGRX_VER=0.11.4 RUN $HOME/.cargo/bin/cargo install cargo-pgrx --version=$PGRX_VER --locked +RUN $HOME/.cargo/bin/cargo pgrx init --pg16 $(which pg_config) # install pglater COPY . .