-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78cb773
commit 48cc174
Showing
6 changed files
with
178 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Build Postgres | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 1 * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-postgres: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/tgdrive/postgres | ||
tags: | | ||
latest | ||
16-alpine | ||
- name: Build Image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./postgres | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
# docker-images | ||
# docker-images | ||
This repository contains docker images needed for teldrive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
FROM postgres:16-alpine | ||
|
||
|
||
ARG PGROONGA_VERSION=3.2.1 | ||
ARG GROONGA_VERSION=14.0.5 | ||
|
||
ENV PGROONGA_VERSION=${PGROONGA_VERSION} \ | ||
GROONGA_VERSION=${GROONGA_VERSION} | ||
|
||
COPY build.sh / | ||
RUN chmod +x /build.sh | ||
RUN \ | ||
apk add --no-cache --virtual=.build-dependencies \ | ||
apache-arrow-dev \ | ||
build-base \ | ||
clang15-dev \ | ||
cmake \ | ||
git \ | ||
gettext-dev \ | ||
linux-headers \ | ||
llvm15 \ | ||
lz4-dev \ | ||
msgpack-c-dev \ | ||
rapidjson-dev \ | ||
ruby \ | ||
samurai \ | ||
xsimd-dev \ | ||
xxhash-dev \ | ||
zlib-dev \ | ||
zstd-dev && \ | ||
/build.sh && \ | ||
rm -f build.sh && \ | ||
apk del .build-dependencies && \ | ||
apk add --no-cache \ | ||
libarrow \ | ||
libxxhash \ | ||
msgpack-c \ | ||
zlib \ | ||
zstd | ||
|
||
COPY start.sh /usr/local/bin/ | ||
|
||
RUN chmod +x /usr/local/bin/start.sh | ||
|
||
ENTRYPOINT ["start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
set -eux | ||
|
||
MECAB_VERSION=0.996 | ||
|
||
mkdir build | ||
pushd build | ||
|
||
wget https://packages.groonga.org/source/groonga/groonga-${GROONGA_VERSION}.tar.gz | ||
tar xf groonga-${GROONGA_VERSION}.tar.gz | ||
pushd groonga-${GROONGA_VERSION} | ||
|
||
pushd vendor | ||
ruby download_mecab.rb | ||
popd | ||
|
||
cmake \ | ||
-S . \ | ||
-B ../groonga.build \ | ||
--preset=release-maximum \ | ||
-DCMAKE_INSTALL_PREFIX=/usr/local | ||
cmake --build ../groonga.build | ||
cmake --install ../groonga.build | ||
popd | ||
|
||
wget https://packages.groonga.org/source/pgroonga/pgroonga-${PGROONGA_VERSION}.tar.gz | ||
tar xf pgroonga-${PGROONGA_VERSION}.tar.gz | ||
pushd pgroonga-${PGROONGA_VERSION} | ||
make PGRN_DEBUG=yes HAVE_MSGPACK=1 MSGPACK_PACKAGE_NAME=msgpack-c -j$(nproc) | ||
make install | ||
popd | ||
|
||
git clone https://github.com/pgvector/pgvector.git | ||
pushd pgvector | ||
make -j$(nproc) | ||
make install | ||
popd | ||
|
||
git clone https://github.com/citusdata/pg_cron.git | ||
pushd pg_cron | ||
make -j$(nproc) | ||
make install | ||
popd | ||
|
||
popd | ||
rm -rf build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
echo "Starting custom entrypoint..." | ||
|
||
# Initialize the database but don't start postgres | ||
docker-entrypoint.sh postgres -h '' & | ||
PID=$! | ||
|
||
# Wait for the initialization to complete | ||
echo "Waiting for PostgreSQL to initialize..." | ||
until pg_isready; do | ||
sleep 1 | ||
done | ||
|
||
# Stop the temporary PostgreSQL process | ||
echo "Stopping temporary PostgreSQL process..." | ||
kill -s TERM $PID | ||
wait $PID | ||
|
||
# Modify the PostgreSQL configuration | ||
echo "Modifying PostgreSQL configuration..." | ||
echo "shared_preload_libraries = 'pg_cron'" >> /var/lib/postgresql/data/postgresql.conf | ||
echo "cron.database_name = '${POSTGRES_DB:-postgres}'" >> /var/lib/postgresql/data/postgresql.conf | ||
|
||
echo "Starting PostgreSQL..." | ||
# Has to run as the postgres user | ||
exec su - postgres -c "postgres -D /var/lib/postgresql/data" |