Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: 'Set up Docker Buildx'
uses: docker/setup-buildx-action@v3

- name: 'Build Postgres Image'
run: |
docker build \
docker buildx build \
-f Dockerfile.postgres \
--platform linux/amd64 \
-t ghcr.io/trycompa/postgres:${{ inputs.tag }} .
docker push ghcr.io/trycompa/postgres:${{ inputs.tag }}
--platform linux/amd64,linux/arm64 \
-t ghcr.io/trycompa/postgres:${{ inputs.tag }} \
--push .
3 changes: 3 additions & 0 deletions Dockerfile.postgres
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ RUN apt-get update && apt-get install -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /docker-entrypoint-initdb.d
COPY ./initdb-vector.sh /docker-entrypoint-initdb.d/vector.sh

# log all queries
CMD ["postgres", "-c", "log_statement=all"]
19 changes: 19 additions & 0 deletions initdb-vector.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

set -e

# Perform all actions as $POSTGRES_USER
export PGUSER="$POSTGRES_USER"

# Create the 'template_vector' template db
"${psql[@]}" <<- 'EOSQL'
CREATE DATABASE template_vector IS_TEMPLATE true;
EOSQL

# Load vector into both template_database and $POSTGRES_DB
for DB in template_postgis "$POSTGRES_DB"; do
echo "Loading PostGIS extensions into $DB"
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
CREATE EXTENSION IF NOT EXISTS vector;
EOSQL
done
Loading