Skip to content

Commit

Permalink
Fix docker build (#55)
Browse files Browse the repository at this point in the history
* fix build
  • Loading branch information
ChuckHend authored Jun 6, 2024
1 parent 0ac35b0 commit 3e6b663
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
17 changes: 9 additions & 8 deletions .github/workflows/pg_later_ext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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).
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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
--------------------
{
Expand Down
3 changes: 2 additions & 1 deletion images/pglater-pg/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand All @@ -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 . .
Expand Down

0 comments on commit 3e6b663

Please sign in to comment.