From 3e511f40b5bf3c48fabf7ed2183df9d02cd150fb Mon Sep 17 00:00:00 2001 From: I-am-PUID-0 <36779668+I-am-PUID-0@users.noreply.github.com> Date: Mon, 28 Oct 2024 18:54:14 -0400 Subject: [PATCH] Dockerfile --- Dockerfile | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3518d90..6afc5ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,18 @@ FROM alpine:3.20 AS pgagent-builder RUN apk add --no-cache --virtual .build-deps \ - cmake boost-dev build-base linux-headers postgresql-dev curl unzip && \ - curl -L https://github.com/pgadmin-org/pgagent/archive/refs/heads/master.zip -o pgagent.zip && \ - unzip pgagent.zip && \ - sed -i 's/EXEC_PROGRAM/execute_process/g' pgagent-master/cmake/FindPG.cmake && \ - sed -i 's/cmake_minimum_required(VERSION 3.3)/cmake_minimum_required(VERSION 3.16)/g' pgagent-master/CMakeLists.txt && \ - cd pgagent-master && mkdir build && cd build && \ - cmake -DCMAKE_INSTALL_PREFIX=/usr/local \ - -DBoost_INCLUDE_DIR=/usr/include \ - -DBoost_LIBRARY_DIRS=/usr/lib \ - -DPostgreSQL_CONFIG_EXECUTABLE=$(which pg_config) .. && \ - make && make install && \ + cmake boost-dev build-base linux-headers postgresql-dev curl unzip jq && \ + RELEASE_TAG=$(curl -s https://api.github.com/repos/pgadmin-org/pgagent/releases/latest | jq -r .tag_name) && \ + curl -L https://github.com/pgadmin-org/pgagent/archive/refs/tags/$RELEASE_TAG.zip -o pgagent-latest.zip && \ + unzip pgagent-latest.zip && \ + mv pgagent-*/ pgagent && \ + cd pgagent && mkdir build && cd build && \ + cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. && make && make install && \ mkdir -p /usr/share/postgresql16/extension && \ cp ../sql/pgagent*.sql /usr/share/postgresql16/extension/ && \ cp ../pgagent.control.in /usr/share/postgresql16/extension/pgagent.control && \ PGAGENT_VERSION=$(ls /usr/share/postgresql16/extension/pgagent--*.sql | sed -E 's/.*pgagent--([0-9]+\.[0-9]+).*/\1/' | sort -V | tail -n 1) && \ sed -i "s/\${MAJOR_VERSION}.\${MINOR_VERSION}/$PGAGENT_VERSION/" /usr/share/postgresql16/extension/pgagent.control && \ - cd ../.. && rm -rf pgagent-master pgagent.zip && \ + cd ../.. && rm -rf pgagent pgagent-latest.zip && \ apk del .build-deps