diff --git a/.github/workflows/build_images.yaml b/.github/workflows/build_images.yaml index f41026d..28af410 100644 --- a/.github/workflows/build_images.yaml +++ b/.github/workflows/build_images.yaml @@ -41,7 +41,7 @@ jobs: # in a pull request, and using all directories on the release # or main branches. changed_relative_to_ref: origin/${{ github.base_ref || 'not-a-branch' }} - ignore_dirs: ".tembo, tembo-pg-slim" + ignore_dirs: ".tembo, tembo-pg-slim, tembo-pg-cnpg" build_and_push: name: Build and push images @@ -115,18 +115,14 @@ jobs: steps: - name: Check out the repo uses: actions/checkout@v3 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - with: - image: quay.io/coredb/binfmt:latest - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to Quay.io uses: docker/login-action@v2 with: registry: quay.io - username: ${{ secrets.QUAY_USER }} - password: ${{ secrets.QUAY_PASSWORD }} + username: ${{ secrets.QUAY_USER_TEMBO }} + password: ${{ secrets.QUAY_PASSWORD_TEMBO }} - name: Build and push run: | set -xe @@ -139,5 +135,46 @@ jobs: --build-arg PG_VERSION=${{ matrix.pg_version }} \ --build-arg PG_MAJOR=${{ matrix.pg_major }} \ --platform linux/amd64,linux/arm64 \ - --tag quay.io/tembo/tembo-pg-slim:pg${{ matrix.pg_version }} \ + --tag quay.io/tembo/tembo-pg-slim:pg${{ matrix.pg_major }} \ --pull ${PUSH_FLAG} ./tembo-pg-slim + + build_and_push_pg_cnpg: + name: Build and push tembo-pg-cnpg + runs-on: + - self-hosted + - dind + - large-8x8 + strategy: + fail-fast: false + matrix: + include: + - pg_version: "14" + - pg_version: "15" + - pg_version: "16" + steps: + - name: Check out the repo + uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Quay.io + uses: docker/login-action@v2 + with: + registry: quay.io + username: ${{ secrets.QUAY_USER_TEMBO }} + password: ${{ secrets.QUAY_PASSWORD_TEMBO }} + - name: Get short SHA + id: sha + run: echo "::set-output name=sha::$(git rev-parse --short HEAD)" + - name: Build and push + run: | + set -xe + BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) + PUSH_FLAG="" + if [ "${BRANCH_NAME}" == "main" ]; then + PUSH_FLAG="--push" + fi + docker buildx build \ + --build-arg PG_VERSION=${{ matrix.pg_version }} \ + --platform linux/amd64 \ + --tag quay.io/tembo/tembo-pg-cnpg:pg${{ matrix.pg_version }}-${{ steps.sha.outputs.sha }} \ + --pull ${PUSH_FLAG} ./tembo-pg-cnpg \ No newline at end of file diff --git a/tembo-pg-cnpg/Dockerfile b/tembo-pg-cnpg/Dockerfile index dbe7583..0f0f824 100644 --- a/tembo-pg-cnpg/Dockerfile +++ b/tembo-pg-cnpg/Dockerfile @@ -1,3 +1,5 @@ +ARG PG_VERSION=15 + FROM rust:1.70-bookworm as builder ARG TRUNK_VER=0.12.12 @@ -5,7 +7,8 @@ ARG TRUNK_VER=0.12.12 ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL sparse RUN cargo install --version $TRUNK_VER pg-trunk -FROM quay.io/tembo/tembo-pg-slim:722acc3 +FROM quay.io/tembo/tembo-pg-slim:pg${PG_VERSION} + USER root # Install trunk @@ -35,6 +38,8 @@ RUN trunk install auto_explain # cache pg_stat_statements and auto_explain and pg_stat_kcache to temp directory RUN set -eux; \ + mkdir /tmp/pg_pkglibdir; \ + mkdir /tmp/pg_sharedir; \ cp -r $(pg_config --pkglibdir)/* /tmp/pg_pkglibdir; \ cp -r $(pg_config --sharedir)/* /tmp/pg_sharedir