From 2c4c230d652f73b1db7090b00943de150c1a2574 Mon Sep 17 00:00:00 2001 From: vados Date: Tue, 19 Dec 2023 04:21:14 +0900 Subject: [PATCH] fix(infra): container generation and workflows During release v0.2.0, the container generation flow failed due to the new addition of pg16. This commit fixes that failure and makes the pg version in use by pgrx more explicit in GHA workflow configuration Signed-off-by: vados --- .dockerignore | 2 + .../workflows/build-and-test-gnu/action.yaml | 14 +++--- .github/workflows/build-rpm/action.yaml | 8 +-- .github/workflows/container.yaml | 12 +++++ .github/workflows/release.yaml | 16 +++--- .gitignore | 1 + Justfile | 26 +++++----- ...e => base-pkg-alpine3.18-amd64.Dockerfile} | 21 +++++--- ...ase-pkg-pg15.5-alpine3.18-amd64.Dockerfile | 49 ------------------- ...g_idkit-pg15.5-alpine3.18-amd64.Dockerfile | 24 +++++---- ...g_idkit-pg16.1-alpine3.18-amd64.Dockerfile | 24 +++++---- 11 files changed, 91 insertions(+), 106 deletions(-) rename infra/docker/{base-pkg-pg16.1-alpine3.18-amd64.Dockerfile => base-pkg-alpine3.18-amd64.Dockerfile} (82%) delete mode 100644 infra/docker/base-pkg-pg15.5-alpine3.18-amd64.Dockerfile diff --git a/.dockerignore b/.dockerignore index eb5a316..613f80f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,3 @@ target +infra/docker +secrets \ No newline at end of file diff --git a/.github/workflows/build-and-test-gnu/action.yaml b/.github/workflows/build-and-test-gnu/action.yaml index 66a8147..12afe3c 100644 --- a/.github/workflows/build-and-test-gnu/action.yaml +++ b/.github/workflows/build-and-test-gnu/action.yaml @@ -40,7 +40,7 @@ inputs: user: type: string default: idkit - pgrx-version: + pgrx-pg-version: type: string default: pg16 decription: | @@ -121,7 +121,7 @@ runs: CARGO_INCREMENTAL: ${{ inputs.cargo-env-incrmental }} CARGO_PROFILE: ${{ inputs.cargo-profile }} CARGO_TARGET_DIR: ${{ inputs.cargo-target-dir }} - PGRX_PG_VERSION: ${{ inputs.pgrx-version }} + PGRX_PG_VERSION: ${{ inputs.pgrx-pg-version }} PGRX_PKG_PATH_PREFIX: ${{ inputs.cargo-target-dir }} PKG_PG_VERSION: ${{ inputs.pg-version }} SCCACHE_DIR: ${{ inputs.sccache-dir }} @@ -142,7 +142,7 @@ runs: CARGO_INCREMENTAL: ${{ inputs.cargo-env-incrmental }} CARGO_PROFILE: ${{ inputs.cargo-profile }} CARGO_TARGET_DIR: ${{ inputs.cargo-target-dir }} - PGRX_PG_VERSION: ${{ inputs.pgrx-version }} + PGRX_PG_VERSION: ${{ inputs.pgrx-pg-version }} PGRX_PKG_PATH_PREFIX: ${{ inputs.cargo-target-dir }} PKG_PG_VERSION: ${{ inputs.pg-version }} SCCACHE_DIR: ${{ inputs.sccache-dir }} @@ -159,7 +159,7 @@ runs: CARGO_INCREMENTAL: ${{ inputs.cargo-env-incrmental }} CARGO_PROFILE: ${{ inputs.cargo-profile }} CARGO_TARGET_DIR: ${{ inputs.cargo-target-dir }} - PGRX_PG_VERSION: ${{ inputs.pgrx-version }} + PGRX_PG_VERSION: ${{ inputs.pgrx-pg-version }} PGRX_PKG_PATH_PREFIX: ${{ inputs.cargo-target-dir }} PKG_PG_VERSION: ${{ inputs.pg-version }} SCCACHE_DIR: ${{ inputs.sccache-dir }} @@ -176,7 +176,7 @@ runs: CARGO_INCREMENTAL: ${{ inputs.cargo-env-incrmental }} CARGO_PROFILE: ${{ inputs.cargo-profile }} CARGO_TARGET_DIR: ${{ inputs.cargo-target-dir }} - PGRX_PG_VERSION: ${{ inputs.pgrx-version }} + PGRX_PG_VERSION: ${{ inputs.pgrx-pg-version }} PGRX_PKG_PATH_PREFIX: ${{ inputs.cargo-target-dir }} PKG_PG_VERSION: ${{ inputs.pg-version }} SCCACHE_DIR: ${{ inputs.sccache-dir }} @@ -193,7 +193,7 @@ runs: CARGO_INCREMENTAL: ${{ inputs.cargo-env-incrmental }} CARGO_PROFILE: ${{ inputs.cargo-profile }} CARGO_TARGET_DIR: ${{ inputs.cargo-target-dir }} - PGRX_PG_VERSION: ${{ inputs.pgrx-version }} + PGRX_PG_VERSION: ${{ inputs.pgrx-pg-version }} PKG_PG_VERSION: ${{ inputs.pg-version }} SCCACHE_DIR: ${{ inputs.sccache-dir }} USER: ${{ inputs.user }} @@ -214,7 +214,7 @@ runs: CARGO_INCREMENTAL: ${{ inputs.cargo-env-incrmental }} CARGO_PROFILE: ${{ inputs.cargo-profile }} CARGO_TARGET_DIR: ${{ inputs.cargo-target-dir }} - PGRX_PG_VERSION: ${{ inputs.pgrx-version }} + PGRX_PG_VERSION: ${{ inputs.pgrx-pg-version }} PGRX_PKG_PATH_PREFIX: ${{ inputs.cargo-target-dir }} PKG_PG_VERSION: ${{ inputs.pg-version }} PKG_TARBALL_SUFFIX: ${{ inputs.artifact-tarball-suffix }} diff --git a/.github/workflows/build-rpm/action.yaml b/.github/workflows/build-rpm/action.yaml index 35c155d..7bf9fe7 100644 --- a/.github/workflows/build-rpm/action.yaml +++ b/.github/workflows/build-rpm/action.yaml @@ -19,7 +19,7 @@ inputs: default: x86_64 decription: | Architecture to use while building the RPM - pgrx-version: + pgrx-pg-version: type: string default: pg16 decription: | @@ -53,7 +53,7 @@ runs: - name: Initialize cargo-pgrx shell: bash env: - PGRX_PG_VERSION: ${{ inputs.pgrx-version }} + PGRX_PG_VERSION: ${{ inputs.pgrx-pg-version }} PKG_PG_VERSION: ${{ inputs.pg-version }} run: | [[ -d /home/runner/.pgrx ]] || cargo pgrx init @@ -61,7 +61,7 @@ runs: - name: Build RPM shell: bash env: - PGRX_PG_VERSION: ${{ inputs.pgrx-version }} + PGRX_PG_VERSION: ${{ inputs.pgrx-pg-version }} PKG_PG_VERSION: ${{ inputs.pg-version }} run: just package build-rpm @@ -69,7 +69,7 @@ runs: id: rpm-output shell: bash env: - PGRX_PG_VERSION: ${{ inputs.pgrx-version }} + PGRX_PG_VERSION: ${{ inputs.pgrx-pg-version }} PKG_PG_VERSION: ${{ inputs.pg-version }} run: | echo path=$(just print-rpm-output-path) >> $GITHUB_OUTPUT diff --git a/.github/workflows/container.yaml b/.github/workflows/container.yaml index b980b6c..4837c1e 100644 --- a/.github/workflows/container.yaml +++ b/.github/workflows/container.yaml @@ -2,6 +2,10 @@ name: container on: push: + branches: + - fix/infra/container-generation-and-workflows # TODO: remove + # Run on auto-generated release PRs + - prep-release-v[0-9]+\.[0-9]+\.[0-9]+ tags: - v[0-9]+\.[0-9]+\.[0-9]+ @@ -21,6 +25,13 @@ jobs: arch: amd64 pg_version: 15.5 os_version: alpine3.18 + - triple: x86_64-unknown-linux-musl + gh: + runner: ubuntu-22.04 + container: + arch: amd64 + pg_version: 16.1 + os_version: alpine3.18 steps: - uses: actions/checkout@v3 - uses: docker/setup-qemu-action@v3 @@ -39,5 +50,6 @@ jobs: run: just build-image push-image env: CONTAINER_IMAGE_ARCH: ${{ matrix.config.container.arch }} + PGRX_PG_VERSION: ${{ matrix.config.container.pg_version }} POSTGRES_IMAGE_VERSION: ${{ matrix.config.container.pg_version }} POSTGRES_OS_IMAGE_VERSION: ${{ matrix.config.container.os_version }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 02f8ebd..6238180 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,11 +16,11 @@ jobs: matrix: config: - pgrx: - version: pg15 + pg-version: pg15 pg: version: 15.5 - pgrx: - version: pg16 + pg-version: pg16 pg: version: 16.1 steps: @@ -30,7 +30,7 @@ jobs: uses: ./.github/workflows/build-rpm with: artifact-upload: true - pgrx-version: ${{ matrix.config.pgrx.version }} + pgrx-pg-version: ${{ matrix.config.pgrx.pg-version }} pg-version: ${{ matrix.config.pg.version }} build-zip-gnu: @@ -41,11 +41,11 @@ jobs: matrix: config: - pgrx: - version: pg15 + pg-version: pg15 pg: version: 15.5 - pgrx: - version: pg16 + pg-version: pg16 pg: version: 16.1 steps: @@ -55,8 +55,8 @@ jobs: uses: ./.github/workflows/build-and-test-gnu with: artifact-upload: true - artifact-tarball-suffix: "-${{ matrix.config.pgrx.version }}-gnu" - pgrx-version: ${{ matrix.config.pgrx.version }} + artifact-tarball-suffix: "-${{ matrix.config.pgrx.pg-version }}-gnu" + pgrx-pg-version: ${{ matrix.config.pgrx.pg-version }} pg-version: ${{ matrix.config.pg.version }} release: @@ -80,7 +80,7 @@ jobs: uses: softprops/action-gh-release@v1 with: prerelease: ${{ startsWith(github.ref, 'refs/heads/prep-release') }} - draft: true + draft: ${{ startsWith(github.ref, 'refs/heads/prep-release') }} # NOTE: while we have the CHANGELOG file, it always contains *all* changes, # so we will use the generated GitHub commits for now generate_release_notes: true diff --git a/.gitignore b/.gitignore index 77ca15a..a483f38 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ secrets/docker/buildx/ # Releases /pkg +/pg_idkit-*-gnu.tar.gz diff --git a/Justfile b/Justfile index bf16398..a621814 100644 --- a/Justfile +++ b/Justfile @@ -1,5 +1,3 @@ -user := env_var('USER') - docker := env_var_or_default("DOCKER", "docker") git := env_var_or_default("GIT", "git") tar := env_var_or_default("TAR", "tar") @@ -27,11 +25,15 @@ changelog_file_path := absolute_path(justfile_directory() / "CHANGELOG") pkg_pg_version := env_var_or_default("PKG_PG_VERSION", "16.1") pkg_pg_config_path := env_var_or_default("PKG_PG_CONFIG_PATH", "~/.pgrx/" + pkg_pg_version + "/pgrx-install/bin/pg_config") -pkg_tarball_suffix := env_var_or_default("PKG_TARBALL_SUFFIX", "-gnu") +pkg_tarball_suffix := env_var_or_default("PKG_TARBALL_SUFFIX", "") pgrx_pg_version := env_var_or_default("PGRX_PG_VERSION", "pg16") pgrx_pkg_path_prefix := env_var_or_default("PGRX_PKG_PATH_PREFIX", "target") -pgrx_pkg_output_dir := pgrx_pkg_path_prefix / "release" / "pg_idkit-" + pgrx_pg_version / "home" / user / ".pgrx" / pkg_pg_version / "pgrx-install" +# If /root, 'home' does not appear in the generated prefix +pkg_user_dir_prefix := if docker_build_user == "root" { docker_build_user } else { "home/" + docker_build_user } +pgrx_pkg_output_dir := pgrx_pkg_path_prefix / "release" / "pg_idkit-" + pgrx_pg_version / pkg_user_dir_prefix / ".pgrx" / pkg_pg_version / "pgrx-install" + +docker_build_user := env_var_or_default('DOCKER_BUILD_USER', "root") default: {{just}} --list @@ -108,8 +110,10 @@ build-watch: _check-tool-cargo _check-tool-cargo-watch build-test-watch: _check-tool-cargo _check-tool-cargo-watch {{cargo_watch}} -x "test $(CARGO_BUILD_FLAGS)" --watch src -package: +build-package: PGRX_IGNORE_RUST_VERSIONS=y {{cargo}} pgrx package --pg-config {{pkg_pg_config_path}} + +package: build-package mkdir -p pkg/pg_idkit-$({{just}} print-version) cp -r $({{just}} print-pkg-output-dir)/* pkg/pg_idkit-$({{just}} print-version) {{tar}} -C pkg -cvf pg_idkit-$(just print-version){{pkg_tarball_suffix}}.tar.gz pg_idkit-$({{just}} print-version) @@ -187,7 +191,7 @@ builder_gnu_image_name_full := env_var_or_default("BUILDER_IMAGE_NAME_FULL", bui # Build the docker image used in BUILDER build-builder-image: - {{docker}} build --build-arg USER={{user}} -f {{builder_gnu_dockerfile_path}} -t {{builder_gnu_image_name_full}} . + {{docker}} build -f {{builder_gnu_dockerfile_path}} -t {{builder_gnu_image_name_full}} . # Push the docker image used in BUILDER (to GitHub Container Registry) push-builder-image: @@ -202,15 +206,15 @@ push-builder-image: # # Determine the Dockerfile to use when building the packaging utility base image -base_pkg_dockerfile_path := "infra/docker/base-pkg-pg" + pkg_pg_version + "-" + pg_os_image_version + "-" + container_img_arch + ".Dockerfile" +base_pkg_dockerfile_path := "infra/docker/base-pkg-" + pg_os_image_version + "-" + container_img_arch + ".Dockerfile" base_pkg_image_name := env_var_or_default("PKG_IMAGE_NAME", "ghcr.io/vadosware/pg_idkit/base-pkg") base_pkg_version := env_var_or_default("PKG_IMAGE_NAME", "0.1.x") -base_pkg_image_tag := env_var_or_default("POSGRES_IMAGE_VERSION", base_pkg_version + "-" + "pg" + pg_image_version + "-" + pg_os_image_version + "-" + container_img_arch) +base_pkg_image_tag := env_var_or_default("POSGRES_IMAGE_VERSION", base_pkg_version + "-" + pg_os_image_version + "-" + container_img_arch) base_pkg_image_name_full := env_var_or_default("PKG_IMAGE_NAME_FULL", base_pkg_image_name + ":" + base_pkg_image_tag) # Build the base image for packaging build-base-pkg-image: - {{docker}} build --build-arg USER={{user}} -f {{base_pkg_dockerfile_path}} . -t {{base_pkg_image_name_full}}; + {{docker}} build --build-arg USER={{docker_build_user}} -f {{base_pkg_dockerfile_path}} . -t {{base_pkg_image_name_full}}; # Push the base image for packaging push-base-pkg-image: @@ -226,7 +230,7 @@ push-base-pkg-image: # Build the docker image for pg_idkit build-image: - {{docker}} build {{docker_platform_arg}} {{docker_progress_arg}} -f {{img_dockerfile_path}} -t {{pgidkit_image_name_full}} --build-arg USER={{user}} --build-arg PGIDKIT_REVISION={{revision}} --build-arg PGIDKIT_VERSION={{pgidkit_image_tag}} . + {{docker}} build {{docker_platform_arg}} {{docker_progress_arg}} -f {{img_dockerfile_path}} -t {{pgidkit_image_name_full}} --build-arg USER={{docker_build_user}} --build-arg PGIDKIT_REVISION={{revision}} --build-arg PGIDKIT_VERSION={{pgidkit_image_tag}} . # Push the docker image for pg_idkit push-image: @@ -246,7 +250,7 @@ rpm_scratch_location := "/tmp/pg_idkit/rpm/scratch" # Build an RPM distribution for pg_idkit build-rpm: _check-tool-strip _check-tool-cargo-generate-rpm - CARGO_FEATURES={{pgrx_pg_version}} {{just}} build-release + CARGO_FEATURES={{pgrx_pg_version}} {{just}} package {{strip}} -s {{pgrx_pkg_output_dir}}/lib/postgresql/pg_idkit.so mkdir -p {{rpm_scratch_location}} cp -r {{pgrx_pkg_output_dir}} {{rpm_scratch_location}} diff --git a/infra/docker/base-pkg-pg16.1-alpine3.18-amd64.Dockerfile b/infra/docker/base-pkg-alpine3.18-amd64.Dockerfile similarity index 82% rename from infra/docker/base-pkg-pg16.1-alpine3.18-amd64.Dockerfile rename to infra/docker/base-pkg-alpine3.18-amd64.Dockerfile index 2efcce4..b7d19b2 100644 --- a/infra/docker/base-pkg-pg16.1-alpine3.18-amd64.Dockerfile +++ b/infra/docker/base-pkg-alpine3.18-amd64.Dockerfile @@ -1,4 +1,4 @@ -FROM postgres:16.1-alpine3.18@sha256:b788d196db04847b17df664f4ae18062e712328d225b9ff75d4d7cd91a16c374 AS builder +FROM alpine:3.19.0@sha256:13b7e62e8df80264dbb747995705a986aa530415763a6c58f84a3ca8af9a5bcd AS builder # Allow for overriding rust toolcahin version ARG RUST_TOOLCHAIN_VERSION=1.74 @@ -14,19 +14,25 @@ ENV PGRX_PG_VERSION=$PGRX_PG_VERSION ARG CARGO_FEATURES=pg16 ENV CARGO_FEATURES=$CARGO_FEATURES -ARG USER -ENV USER=$USER - # Install OS deps RUN apk add --no-cache \ alpine-sdk \ - coreutils \ + bash \ + bison \ clang \ clang-dev \ clang-libs \ + coreutils \ + flex \ + icu-dev \ + linux-headers \ musl-dev \ openssl-dev \ - rustup + perl \ + readline \ + readline-dev \ + rustup \ + zlib-dev # Install Rust & related deps RUN rustup-init -y --profile minimal --default-toolchain $RUST_TOOLCHAIN_VERSION @@ -43,8 +49,7 @@ COPY . . # Initialize pgrx ENV PGRX_IGNORE_RUST_VERSIONS=y -ENV PKG_PG_CONFIG_PATH=/usr/local/bin/pg_config -RUN cargo pgrx init --pg16=$PKG_PG_CONFIG_PATH +RUN just pgrx-init # Build the package RUN RUSTFLAGS="-Ctarget-feature=-crt-static" just build package diff --git a/infra/docker/base-pkg-pg15.5-alpine3.18-amd64.Dockerfile b/infra/docker/base-pkg-pg15.5-alpine3.18-amd64.Dockerfile deleted file mode 100644 index 57a506b..0000000 --- a/infra/docker/base-pkg-pg15.5-alpine3.18-amd64.Dockerfile +++ /dev/null @@ -1,49 +0,0 @@ -FROM postgres:15.5-alpine3.18@sha256:a57387207806d947c842f1be9f358e37b05442bf8b5ed19b1a69af281be930e7 AS builder - -# Allow for overriding rust toolcahin version -ARG RUST_TOOLCHAIN_VERSION=1.74 -ENV RUST_TOOLCHAIN_VERSION=$RUST_TOOLCHAIN_VERSION - -# Allow for overriding of PGRX PG version that is used -ARG PGRX_PG_VERSION=pg15 -ENV PGRX_PG_VERSION=$PGRX_PG_VERSION - -# Allow overriding features so that this file can be used to build -# different crate features. By default since this is a 15.5 base package -# we expect to build with crate feature 'pg15' -ARG CARGO_FEATURES=pg15 -ENV CARGO_FEATURES=$CARGO_FEATURES - -# Allow for overriding unix user -ARG USER -ENV USER=$USER - -# Install OS deps -RUN apk add --no-cache \ - alpine-sdk \ - clang \ - clang-dev \ - clang-libs \ - coreutils \ - musl-dev \ - openssl-dev \ - rustup - -# Install Rust & related deps -RUN rustup-init -y --profile minimal --default-toolchain $RUST_TOOLCHAIN_VERSION -ENV PATH="/root/.cargo/bin:${PATH}" -RUN cargo install just cargo-get - -# Install pgrx -# (disabling the static C runtime is required since pgrx requires dynamic linking w/ libssl and libcrypto) -RUN RUSTFLAGS="-Ctarget-feature=-crt-static" cargo install --locked cargo-pgrx@0.11.2 - -# Copy in pg_idkit code -WORKDIR /pg_idkit -COPY . . - -# Perform the build and packaging of pg_idkit -ENV PGRX_IGNORE_RUST_VERSIONS=y -ENV PKG_PG_CONFIG_PATH=/usr/local/bin/pg_config -RUN cargo pgrx init --pg15=$PKG_PG_CONFIG_PATH -RUN RUSTFLAGS="-Ctarget-feature=-crt-static" just build package diff --git a/infra/docker/pg_idkit-pg15.5-alpine3.18-amd64.Dockerfile b/infra/docker/pg_idkit-pg15.5-alpine3.18-amd64.Dockerfile index 1a955c3..defb8e4 100644 --- a/infra/docker/pg_idkit-pg15.5-alpine3.18-amd64.Dockerfile +++ b/infra/docker/pg_idkit-pg15.5-alpine3.18-amd64.Dockerfile @@ -2,11 +2,21 @@ # NOTE: you must have the base packaging layer built for this image to work # you can build this from scratch with `just build-base-pkg-image` # -FROM ghcr.io/vadosware/pg_idkit/base-pkg:0.1.x-pg15.5-alpine3.18-amd64 AS builder +# `cargo pgrx init` is run in the base-pkg, so it contains the versions of pg that will be used. +# +FROM ghcr.io/vadosware/pg_idkit/base-pkg:0.1.x-alpine3.18-amd64 AS builder ARG USER ENV USER=$USER +ARG PGRX_PG_VERSION=pg15 +ENV PGRX_PG_VERSION=$PGRX_PG_VERSION + +ARG PKG_PG_VERSION=15.5 +ENV PKG_PG_VERSION=$PKG_PG_VERSION + +ENV PKG_TARBALL_SUFFIX="-musl" + # Re-run the build with the latest code WORKDIR /pg_idkit COPY . . @@ -16,17 +26,13 @@ FROM postgres:15.5-alpine3.18@sha256:a57387207806d947c842f1be9f358e37b05442bf8b5 # NOTE: PGRX_PG_VERSION is defined via base-pkg:pg15.5-alpine3.18-amd64 ARG PGRX_PG_VERSION=pg15 -ARG PGIDKIT_REVISION - -# Copy relevant built-files -COPY --from=builder /pg_idkit/target/release/pg_idkit-${PGRX_PG_VERSION}/usr /usr - -# expected @ /usr/local/share/postgresql/extension -# actually @ ./local/share/postgresql/extension/pg_idkit.control - ARG PGIDKIT_VERSION ARG PGIDKIT_REVISION +# Install packaged pg_idkit for system postgres +COPY --from=builder /pg_idkit/pg_idkit-*-musl.tar.gz /tmp +RUN tar -C /usr/local --strip-components=1 -xvf /tmp/pg_idkit-*-musl.tar.gz + LABEL org.opencontainers.image.authors="Victor Adossi " LABEL org.opencontainers.image.description="A distribution of the base postgres image, with pg_idkit pre-installed." LABEL org.opencontainers.image.documentation="https://github.com/VADOSWARE/pg_idkit#readme" diff --git a/infra/docker/pg_idkit-pg16.1-alpine3.18-amd64.Dockerfile b/infra/docker/pg_idkit-pg16.1-alpine3.18-amd64.Dockerfile index a9db144..65b1a94 100644 --- a/infra/docker/pg_idkit-pg16.1-alpine3.18-amd64.Dockerfile +++ b/infra/docker/pg_idkit-pg16.1-alpine3.18-amd64.Dockerfile @@ -2,29 +2,33 @@ # NOTE: you must have the base packaging layer built for this image to work # you can build this from scratch with `just build-base-pkg-image` # -FROM ghcr.io/vadosware/pg_idkit/base-pkg:0.1.x-pg16.1-alpine3.18-amd64 AS builder +FROM ghcr.io/vadosware/pg_idkit/base-pkg:0.1.x-alpine3.18-amd64 AS builder ARG USER ENV USER=$USER +ARG PGRX_PG_VERSION=pg16 +ENV PGRX_PG_VERSION=$PGRX_PG_VERSION + +ARG PKG_PG_VERSION=16.1 +ENV PKG_PG_VERSION=$PKG_PG_VERSION + +ENV PKG_TARBALL_SUFFIX="-musl" + # Re-run the build with the latest code WORKDIR /pg_idkit COPY . . RUN RUSTFLAGS="-Ctarget-feature=-crt-static" just build package -FROM postgres:15.5-alpine3.18@sha256:a57387207806d947c842f1be9f358e37b05442bf8b5ed19b1a69af281be930e7 +FROM postgres:16.1-alpine3.18@sha256:a44705e05d7c52add276c29d355851c63b8ce7df764191095c7337848bc2d69b # NOTE: PGRX_PG_VERSION is defined via base-pkg:pg16.1-alpine3.18-amd64 ARG PGRX_PG_VERSION=pg16 -ARG PGIDKIT_REVISION - ENV PGRX_PG_VERSION=$PGRX_PG_VERSION -# Copy relevant built-files -COPY --from=builder /pg_idkit/target/release/pg_idkit-${PGRX_PG_VERSION}/usr /usr - -# expected @ /usr/local/share/postgresql/extension -# actually @ ./local/share/postgresql/extension/pg_idkit.control +# Install packaged pg_idkit for system postgres +COPY --from=builder /pg_idkit/pg_idkit-*-musl.tar.gz /tmp +RUN tar -C /usr/local --strip-components=1 -xvf /tmp/pg_idkit-*-musl.tar.gz ARG PGIDKIT_VERSION ARG PGIDKIT_REVISION @@ -33,7 +37,7 @@ LABEL org.opencontainers.image.authors="Victor Adossi " LABEL org.opencontainers.image.description="A distribution of the base postgres image, with pg_idkit pre-installed." LABEL org.opencontainers.image.documentation="https://github.com/VADOSWARE/pg_idkit#readme" LABEL org.opencontainers.image.licenses="Apache-2.0" -LABEL org.opencontainers.image.revision=$PGIDKIT_REVISION +LABEL org.opencontainers.image.revision=${PGIDKIT_REVISION} LABEL org.opencontainers.image.source="https://github.com/VADOSWARE/pg_idkit" LABEL org.opencontainers.image.title="Postgres + pg_idkit" LABEL org.opencontainers.image.url="https://github.com/VADOSWARE/pg_idkit"