Skip to content
This repository was archived by the owner on Sep 22, 2023. It is now read-only.

Commit d4ecfe3

Browse files
fdietzefutilekrux02
authored
add plv8 (#7)
Co-authored-by: Felix Rath <[email protected]> Co-authored-by: Arne Döring <[email protected]> Co-authored-by: Felix Dietze <[email protected]>
1 parent 33b8f1d commit d4ecfe3

File tree

4 files changed

+103
-8
lines changed

4 files changed

+103
-8
lines changed

.github/workflows/build.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: build
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
8+
# automatically cancel previous runs on the same PR
9+
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre/67939898#67939898
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
12+
cancel-in-progress: true
13+
14+
15+
jobs:
16+
# tmate:
17+
# name: TMate
18+
# runs-on: postgres-builder-32core
19+
# timeout-minutes: 120
20+
# steps:
21+
# - name: Checkout
22+
# uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # pin@v3
23+
# with:
24+
# # https://github.com/actions/checkout/issues/626
25+
# # This is correct, because we're using a merge queue (mergify) which only merges when built against the latest target branch.
26+
# # https://docs.mergify.com/actions/queue/
27+
# ref: ${{ github.event.pull_request.head.sha }}
28+
29+
# - name: Set up Docker Buildx
30+
# uses: docker/setup-buildx-action@v2
31+
32+
# - name: Setup tmate session
33+
# uses: mxschmitt/action-tmate@v3
34+
35+
docker-build:
36+
name: Build Docker ${{ fromJson(matrix.image).dockerfile }}
37+
runs-on: postgres-builder-32core
38+
timeout-minutes: 120
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
image:
43+
- '{"dockerfile": "./Dockerfile", "context": ".", "platforms": "linux/amd64" }'
44+
- '{"dockerfile": "./Dockerfile.ami_buildscript", "context": ".", "platforms": "linux/amd64" }'
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # pin@v3
48+
with:
49+
# https://github.com/actions/checkout/issues/626
50+
# This is correct, because we're using a merge queue (mergify) which only merges when built against the latest target branch.
51+
# https://docs.mergify.com/actions/queue/
52+
ref: ${{ github.event.pull_request.head.sha }}
53+
54+
- name: Set up Docker Buildx
55+
uses: docker/setup-buildx-action@v2
56+
57+
- name: Docker Cache
58+
uses: actions/cache@v3
59+
with:
60+
path: /tmp/.buildx-cache
61+
key: ${{ runner.os }}-${{ fromJson(matrix.image).dockerfile }}-buildx
62+
63+
- name: Docker build
64+
uses: docker/build-push-action@v4
65+
with:
66+
context: ${{ fromJson(matrix.image).context }}
67+
file: ${{ fromJson(matrix.image).dockerfile }}
68+
platforms: ${{ fromJson(matrix.image).platforms }}
69+
cache-from: type=local,src=/tmp/.buildx-cache
70+
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
71+
push: false

Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ ENV PLV8_VERSION=${PLV8_VERSION}
2525
RUN set -ex && \
2626
git clone --branch ${PLV8_BRANCH} https://github.com/plv8/plv8 /plv8
2727

28-
RUN make -j32 -C /plv8 install || true
29-
RUN make -j32 -C /plv8 install
28+
RUN make -j$(nproc --all) -C /plv8 plv8_config.h
29+
RUN make -j$(nproc --all) -C /plv8 install
3030

3131
RUN strip /usr/lib/postgresql/${PG_MAJOR}/lib/plv8-${PLV8_VERSION}.so
3232

3333
# install our own postgres extension source code
3434
COPY postgres_extension /postgres_extension/
3535

3636
# build and install custom postgres extension
37-
RUN make -C /postgres_extension/functions
37+
RUN make -j$(nproc --all) -C /postgres_extension/functions
3838
RUN make -C /postgres_extension/functions install
3939

4040
RUN git clone https://github.com/chimpler/postgres-aws-s3.git /postgres-aws-s3 && \

Dockerfile.ami_buildscript

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM amazonlinux:2
2+
3+
COPY ./postgres_extension/ /postgres_extension
4+
5+
COPY imagebuild.sh .
6+
RUN bash imagebuild.sh

imagebuild.sh

+23-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
11
#!/bin/sh
22

3-
set -Eeuo pipefail
3+
set -Eeuxo pipefail
44

55
amazon-linux-extras install postgresql14
6-
yum -y install postgresql-server postgresql-server-devel postgresql-plpython3 git gcc jq
6+
yum -y install postgresql-server postgresql-server-devel postgresql-plpython3 git gcc jq wget tar make xz \
7+
libxml2-devel libyaml-devel lz4-devel libzstd-devel bzip2-devel \
8+
ncurses-compat-libs
9+
10+
711
pip3 install requests
812

9-
make -C /postgres_extension/functions
10-
make -C /postgres_extension/functions install
13+
cd /
14+
wget https://github.com/Kitware/CMake/releases/download/v3.27.4/cmake-3.27.4-linux-x86_64.tar.gz
15+
tar -xvzf cmake-3.27.4-linux-x86_64.tar.gz
16+
export PATH="/cmake-3.27.4-linux-x86_64/bin:${PATH}"
17+
18+
CPU_COUNT=$(nproc --all)
19+
20+
PLV8_BRANCH=v3.2.0
21+
mkdir -p /build/
22+
cd /build
23+
git clone --branch "$PLV8_BRANCH" --depth 1 https://github.com/plv8/plv8
24+
25+
sed -i 's/cmake -Denable/CXX=clang++ CC=clang cmake -Denable/' plv8/Makefile
26+
make -C plv8 -j"$CPU_COUNT" plv8_config.h
27+
make -C plv8 -j"$CPU_COUNT" install
28+
make -C /postgres_extension/functions -j"$CPU_COUNT"
29+
make -C /postgres_extension/functions -j"$CPU_COUNT" install
1130

1231
# pgbackrest
13-
yum -y install libxml2-devel libyaml-devel lz4-devel libzstd-devel bzip2-devel
1432
mkdir -p /pgbackrest-build
1533
wget -q -O - https://github.com/pgbackrest/pgbackrest/archive/release/2.42.tar.gz | tar zx -C /pgbackrest-build
1634
cd /pgbackrest-build/pgbackrest-release-2.42/src && ./configure && make

0 commit comments

Comments
 (0)