Skip to content

Commit c36fab2

Browse files
pcncdarora
authored andcommitted
chore: ubuntu 18 binaries
1 parent 1e88a47 commit c36fab2

File tree

2 files changed

+53
-28
lines changed

2 files changed

+53
-28
lines changed

.github/workflows/ami-build-ubuntu-18.yml renamed to .github/workflows/collect-u18-binaries.yml

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
name: Build Ubuntu 18 AMI
1+
name: Collect Ubuntu 18 compatible binaries
22

33
on:
44
push:
55
branches:
66
- develop
7+
- pcnc/pg-upgrade-fixes
78
paths:
89
- '.github/workflows/ami-build-ubuntu-18.yml'
910
- 'common.vars.pkr.hcl'
@@ -93,21 +94,29 @@ jobs:
9394
for layer in /tmp/build/*/layer.tar; do
9495
tar xvf "$layer" -C ansible/files/postgres --strip-components 1
9596
done
96-
- name: Build AMI
97-
run: |
98-
GIT_SHA=${{github.sha}}
99-
packer build -var "git-head-version=${GIT_SHA}" -var "packer-execution-id=u18-${GITHUB_RUN_ID}" -var-file="development-arm.vars.pkr.hcl" -var-file="common.vars.pkr.hcl" -var-file="legacy.vars.pkr.hcl" amazon-arm64.pkr.hcl
97+
98+
- name: Build surrogate Docker image
99+
uses: docker/build-push-action@v3
100+
with:
101+
push: false
102+
load: true
103+
file: docker/Dockerfile-u18
104+
target: pg_binary_collection
105+
build-args: |
106+
ubuntu_release=${{ matrix.ubuntu_release }}
107+
ubuntu_release_no=${{ matrix.ubuntu_version }}
108+
postgresql_major=${{ steps.version.outputs.postgresql_major }}
109+
postgresql_release=${{ steps.version.outputs.postgresql_release }}
110+
tags: supabase/postgres:u18-binaries
111+
platforms: linux/${{ matrix.arch }}
112+
cache-from: type=gha
113+
cache-to: type=gha,mode=max,ignore-error=true
100114

101-
- name: Grab release version
102-
id: process_release_version
103-
run: |
104-
VERSION=$(sed -e 's/postgres-version = "\(.*\)"/\1/g' common.vars.pkr.hcl)
105-
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
106-
107-
- name: List files
108-
id: list_files
115+
- name: Copy binary tarball
109116
run: |
110-
ls -la /tmp/
117+
CONTAINER_ID=$(docker create supabase/postgres:u18-binaries)
118+
docker cp "${CONTAINER_ID}:/tmp/pg_binaries/${{ matrix.ubuntu_version }}.tar.gz" > /tmp/pg_binaries.tar.gz
119+
docker rm "${CONTAINER_ID}"
111120
112121
- name: configure aws credentials - staging
113122
uses: aws-actions/configure-aws-credentials@v1

Dockerfile-u18

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -873,19 +873,6 @@ ARG supautils_release
873873
ADD "https://github.com/supabase/supautils/releases/download/v${supautils_release}/supautils-v${supautils_release}-pg${postgresql_major}-${TARGETARCH}-linux-gnu.deb" \
874874
/tmp/supautils.deb
875875

876-
####################
877-
# setup-wal-g.yml
878-
####################
879-
FROM base as walg
880-
ARG wal_g_release
881-
# ADD "https://github.com/wal-g/wal-g/releases/download/v${wal_g_release}/wal-g-pg-ubuntu-18.04-${TARGETARCH}.tar.gz" /tmp/wal-g.tar.gz
882-
RUN arch=$([ "$TARGETARCH" = "arm64" ] && echo "aarch64" || echo "$TARGETARCH") && \
883-
apt-get update && apt-get install -y --no-install-recommends curl && \
884-
curl -kL "https://github.com/wal-g/wal-g/releases/download/v${wal_g_release}/wal-g-pg-ubuntu-18.04-${arch}.tar.gz" -o /tmp/wal-g.tar.gz && \
885-
tar -xvf /tmp/wal-g.tar.gz -C /tmp && \
886-
rm -rf /tmp/wal-g.tar.gz && \
887-
mv /tmp/wal-g-pg-ubuntu*18.04-$arch /tmp/wal-g
888-
889876
####################
890877
# Collect extension packages
891878
####################
@@ -949,7 +936,6 @@ FROM base as production
949936

950937
# Setup extensions
951938
COPY --from=extensions /tmp /tmp
952-
COPY --from=walg /tmp/wal-g /usr/local/bin/
953939

954940
ENV DEBIAN_FRONTEND=noninteractive
955941
RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -1016,3 +1002,33 @@ RUN --mount=type=cache,target=/ccache,from=public.ecr.aws/supabase/postgres:ccac
10161002
cp -r /ccache/* /tmp
10171003
FROM scratch as buildcache
10181004
COPY --from=stats /tmp /
1005+
1006+
FROM ubuntu:bionic as pg_binary_collection_base
1007+
ENV DEBIAN_FRONTEND=noninteractive
1008+
1009+
COPY ansible/files/extensions/* /tmp/build/extensions/
1010+
COPY ansible/files/postgres/* /tmp/build/
1011+
1012+
RUN echo "deb [ trusted=yes ] file:///tmp/build ./" > /etc/apt/sources.list.d/temp.list
1013+
RUN apt-get update && \
1014+
apt-get install -y postgresql-${postgresql_major}=${postgresql_release}-1.pgdg18.04+1 --no-install-recommends && \
1015+
apt-get install -y ca-certificates \
1016+
libcurl3-gnutls libmecab2 libnghttp2-14 \
1017+
libpsl5 librtmp1 libsodium23 mecab-naist-jdic \
1018+
mecab-naist-jdic-eucjp mecab-utils publicsuffix
1019+
RUN rm -f /tmp/build/extensions/postgis* && \
1020+
dpkg -i /tmp/build/extensions/*
1021+
1022+
FROM ubuntu:bionic as pg_binary_collection
1023+
1024+
RUN mkdir -p /tmp/pg_binaries/${postgresql_major}
1025+
COPY --from=pg_binary_collection_base /usr/lib/postgresql/${postgresql_major} /tmp/pg_binaries/${postgresql_major}
1026+
COPY --from=pg_binary_collection_base /usr/lib/postgresql/lib /tmp/pg_binaries/${postgresql_major}/lib
1027+
COPY --from=pg_binary_collection_base /var/lib/postgresql/extension /tmp/pg_binaries/${postgresql_major}/lib
1028+
COPY --from=pg_binary_collection_base /usr/lib/aarch64-linux-gnu/libpq.so.5 /tmp/pg_binaries/${postgresql_major}/lib
1029+
COPY --from=pg_binary_collection_base /usr/lib/aarch64-linux-gnu/libpq.so.5 /tmp/pg_binaries/${postgresql_major}/libpq.so.5
1030+
COPY --from=pg_binary_collection_base /usr/share/postgresql/${postgresql_major} /tmp/pg_binaries/${postgresql_major}/share
1031+
1032+
RUN cd /tmp/pg_binaries && \
1033+
tar czvf 18.04.tar.gz ${postgresql_major}/ && \
1034+
rm -rf ${postgresql_major}/

0 commit comments

Comments
 (0)