-
Notifications
You must be signed in to change notification settings - Fork 5
docker: add new way to build and push docker images, #248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c989115
add new way to build and push docker images, cresate workflow to buil…
Anmol1696 e4a515d
update base image for pgvector and postgit
Anmol1696 5e972db
Update docker/Makefile
Anmol1696 89aa230
Update docker/postgis/Dockerfile
Anmol1696 a032c62
Update docker/pgvector/Dockerfile
Anmol1696 792471e
remove --load flag
Anmol1696 5d05208
add more versions of postgres to the images and versions
Anmol1696 9e555dd
update the base postgis dockerfile to add postgis components
Anmol1696 4758eac
add pgvector-postgis and others version
Anmol1696 b55db9c
fix tab for make command
Anmol1696 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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,97 @@ | ||
| name: Docker | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - v1 | ||
| - release/* | ||
| paths: | ||
| - "docker/**" | ||
| - ".github/workflows/docker.yaml" | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - v1 | ||
| paths: | ||
| - "docker/**" | ||
| - ".github/workflows/docker.yaml" | ||
| types: [opened, reopened, synchronize, ready_for_review] | ||
| workflow_dispatch: | ||
| inputs: | ||
| process: | ||
| description: 'Process to build (pgvector | node-sqitch | postgis)' | ||
| type: choice | ||
| required: true | ||
| options: | ||
| - pgvector | ||
| - node-sqitch | ||
| - postgis | ||
| - pgvector-postgis | ||
| default: pgvector | ||
| version: | ||
| description: 'Specific version to build (must exist in version.yaml)' | ||
| type: string | ||
| required: true | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }}-docker | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build-push: | ||
| if: github.event_name != 'pull_request' || !github.event.pull_request.draft | ||
| runs-on: ubuntu-latest | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: docker | ||
|
|
||
| strategy: | ||
| matrix: | ||
| process: [pgvector, node-sqitch, postgis, pgvector-postgis] | ||
| max-parallel: 3 | ||
|
|
||
| env: | ||
| REPO: ghcr.io/${{ github.repository_owner }} | ||
| PLATFORMS: linux/amd64,linux/arm64 | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Login to GHCR | ||
| if: github.event_name != 'pull_request' | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Build (no push) | ||
| if: github.event_name == 'pull_request' | ||
| run: | | ||
| make \ | ||
| PROCESS=${{ matrix.process }} \ | ||
| REPO_NAME=$REPO \ | ||
| PLATFORMS="$PLATFORMS" \ | ||
| build-process | ||
|
|
||
| - name: Build and push (all versions) | ||
| if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | ||
| run: | | ||
| make \ | ||
| PROCESS=${{ matrix.process }} \ | ||
| REPO_NAME=$REPO \ | ||
| PLATFORMS="$PLATFORMS" \ | ||
| build-push-process |
This file contains hidden or 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,20 +1,93 @@ | ||
| .PHONY: all push-all node-sqitch pgvector clean | ||
| .PHONY: all push-all build-all build-push-all build-process build-push-process \ | ||
| build-process-version build-push-process-version pgvector node-sqitch postgis clean | ||
|
|
||
| all: | ||
| $(MAKE) -C node-sqitch build | ||
| $(MAKE) -C pgvector build | ||
| REPO_NAME?=pyramation | ||
| PLATFORMS?=linux/arm64 | ||
|
|
||
| push-all: | ||
| $(MAKE) -C node-sqitch push | ||
| $(MAKE) -C pgvector push | ||
| # default process if none specified (can be overridden: `make PROCESS=postgis build-process`) | ||
| PROCESS?=pgvector | ||
|
|
||
| node-sqitch: | ||
| $(MAKE) -C node-sqitch build | ||
| # Convenience: list of known processes | ||
| PROCESSES:=pgvector node-sqitch postgis pgvector-postgis | ||
|
|
||
| CONTAINER_NAME?=$(PROCESS) | ||
|
|
||
| ## build-process builds docker image(s) for $(PROCESS) using base+versions from version.yaml | ||
| ## It will build one image per version listed in $(PROCESS)/version.yaml and tag as <repo>/<process>:<version> | ||
| build-process: | ||
| @echo "==> Building process: $(PROCESS)" | ||
| @BASE=$$(sed -n 's/^[[:space:]]*base:[[:space:]]*//p' $(PROCESS)/version.yaml | head -n1); \ | ||
| VERSIONS=$$(sed -n '/^[[:space:]]*versions:/,$$p' $(PROCESS)/version.yaml | sed -n 's/^[[:space:]]*-[[:space:]]*//p'); \ | ||
| if [ -z "$$BASE" ] || [ -z "$$VERSIONS" ]; then \ | ||
| echo "Error: Could not parse base or versions from $(PROCESS)/version.yaml" 1>&2; \ | ||
| exit 1; \ | ||
| fi; \ | ||
| for v in $$VERSIONS; do \ | ||
| $(MAKE) --no-print-directory BASE=$$BASE VERSION=$$v build-process-version || exit $$?; \ | ||
| done | ||
|
|
||
| build-all: | ||
| @for p in $(PROCESSES); do \ | ||
| $(MAKE) --no-print-directory PROCESS=$$p build-process || exit $$?; \ | ||
| done | ||
|
|
||
| build-push-process: | ||
| @echo "==> Building+Pushing process: $(PROCESS)" | ||
| @BASE=$$(sed -n 's/^[[:space:]]*base:[[:space:]]*//p' $(PROCESS)/version.yaml | head -n1); \ | ||
| VERSIONS=$$(sed -n '/^[[:space:]]*versions:/,$$p' $(PROCESS)/version.yaml | sed -n 's/^[[:space:]]*-[[:space:]]*//p'); \ | ||
| if [ -z "$$BASE" ] || [ -z "$$VERSIONS" ]; then \ | ||
| echo "Error: Could not parse base or versions from $(PROCESS)/version.yaml" 1>&2; \ | ||
| exit 1; \ | ||
| fi; \ | ||
| for v in $$VERSIONS; do \ | ||
| $(MAKE) --no-print-directory BASE=$$BASE VERSION=$$v build-push-process-version || exit $$?; \ | ||
| done | ||
|
|
||
| build-push-all: | ||
| @for p in $(PROCESSES); do \ | ||
| $(MAKE) --no-print-directory PROCESS=$$p build-push-process || exit $$?; \ | ||
| done | ||
|
|
||
| # Build only a specific VERSION for $(PROCESS). Intended for internal use by build-process. | ||
| # Usage (internal): $(MAKE) BASE=<base> VERSION=<version> build-process-version | ||
| build-process-version: | ||
| @test -n "$(BASE)" || { echo "Error: BASE is required"; exit 1; } | ||
| @test -n "$(VERSION)" || { echo "Error: VERSION is required"; exit 1; } | ||
| @echo " -> $(BASE):$(VERSION) => $(REPO_NAME)/$(PROCESS):$(VERSION) (build)" | ||
| @docker buildx build \ | ||
| --platform $(PLATFORMS) \ | ||
| --build-arg BASE=$(BASE) \ | ||
| --build-arg BASE_VERSION=$(VERSION) \ | ||
| -t $(REPO_NAME)/$(PROCESS):$(VERSION) \ | ||
| $(PROCESS) | ||
|
|
||
| # Build+push only a specific VERSION for $(PROCESS). Intended for internal use by build-push-process. | ||
| # Usage (internal): $(MAKE) BASE=<base> VERSION=<version> build-push-process-version | ||
| build-push-process-version: | ||
| @test -n "$(BASE)" || { echo "Error: BASE is required"; exit 1; } | ||
| @test -n "$(VERSION)" || { echo "Error: VERSION is required"; exit 1; } | ||
| @echo " -> $(BASE):$(VERSION) => $(REPO_NAME)/$(PROCESS):$(VERSION) (push)" | ||
| @docker buildx build \ | ||
| --platform $(PLATFORMS) \ | ||
| --build-arg BASE=$(BASE) \ | ||
| --build-arg BASE_VERSION=$(VERSION) \ | ||
| -t $(REPO_NAME)/$(PROCESS):$(VERSION) \ | ||
| --push \ | ||
| $(PROCESS) | ||
|
|
||
| # Aliases | ||
| all: build-all | ||
| push-all: build-push-all | ||
|
|
||
| # Convenience per-process targets | ||
| pgvector: | ||
| $(MAKE) -C pgvector build | ||
| $(MAKE) PROCESS=pgvector build-process | ||
|
|
||
| node-sqitch: | ||
| $(MAKE) PROCESS=node-sqitch build-process | ||
|
|
||
| postgis: | ||
| $(MAKE) PROCESS=postgis build-process | ||
|
|
||
| # Git cleanup (repo-level only) | ||
| clean: | ||
| @git reset --hard | ||
| @git ls-files --other --exclude-standard | xargs rm -f | ||
| pgvector-postgis: | ||
| $(MAKE) PROCESS=pgvector-postgis build-process | ||
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,3 @@ | ||||||
| base: node | ||||||
| versions: | ||||||
| - 20.12.0-alpine3.19 | ||||||
|
||||||
| - 20.12.0-alpine3.19 | |
| - 20.12.0-alpine3.19 |
This file contains hidden or 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,30 @@ | ||
| ARG BASE=postgres | ||
| ARG BASE_VERSION=14 | ||
| FROM ${BASE}:${BASE_VERSION} | ||
|
|
||
| LABEL org.opencontainers.image.source="https://github.com/launchql/launchql" | ||
| ARG BASE | ||
| ARG BASE_VERSION | ||
| ENV BASE_VERSION=${BASE_VERSION} | ||
|
|
||
| # Debian-based: install both pgvector and postgis from PGDG per-PG-major | ||
| RUN set -eux; \ | ||
| export DEBIAN_FRONTEND=noninteractive; \ | ||
| apt-get update; \ | ||
| apt-get install -y --no-install-recommends ca-certificates curl gnupg dirmngr; \ | ||
| update-ca-certificates || true; \ | ||
| CODENAME=$(. /etc/os-release && echo "$VERSION_CODENAME"); \ | ||
| install -d -m 0755 /usr/share/keyrings; \ | ||
| curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/keyrings/postgresql.gpg; \ | ||
| echo "deb [signed-by=/usr/share/keyrings/postgresql.gpg] https://apt.postgresql.org/pub/repos/apt ${CODENAME}-pgdg main" > /etc/apt/sources.list.d/pgdg.list; \ | ||
| apt-get update; \ | ||
| PG_MAJOR=$(pg_config --version | sed 's/^PostgreSQL \([0-9]\+\).*/\1/'); \ | ||
| apt-get install -y --no-install-recommends \ | ||
| postgresql-${PG_MAJOR}-postgis-3 \ | ||
| postgresql-${PG_MAJOR}-postgis-3-scripts \ | ||
| postgis \ | ||
| postgresql-${PG_MAJOR}-pgvector \ | ||
| make \ | ||
| bash; \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
This file contains hidden or 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,8 @@ | ||
| base: postgres | ||
| versions: | ||
| - 14.19 | ||
| - 15.14 | ||
| - 16.10 | ||
| - 17.6 | ||
| - 18.0 | ||
|
|
This file contains hidden or 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,12 +1,26 @@ | ||
| FROM pyramation/postgis:13.3-alpine | ||
| ARG BASE=postgres | ||
| ARG BASE_VERSION=14 | ||
| FROM ${BASE}:${BASE_VERSION} | ||
|
|
||
| # Install PGVector extension | ||
| RUN apk add --no-cache --virtual .build-deps \ | ||
| git \ | ||
| build-base \ | ||
| postgresql-dev \ | ||
| && git clone --branch v0.5.1 https://github.com/pgvector/pgvector.git \ | ||
| && cd pgvector \ | ||
| && make && make install \ | ||
| && cd .. && rm -rf pgvector \ | ||
| && apk del .build-deps | ||
| LABEL org.opencontainers.image.source="https://github.com/launchql/launchql" | ||
| ARG BASE | ||
| ARG BASE_VERSION | ||
| ENV BASE_VERSION=${BASE_VERSION} | ||
|
|
||
| # Debian-based install: use PGDG per-PG-major package | ||
| RUN set -eux; \ | ||
| export DEBIAN_FRONTEND=noninteractive; \ | ||
| apt-get update; \ | ||
| apt-get install -y --no-install-recommends ca-certificates curl gnupg dirmngr; \ | ||
| update-ca-certificates || true; \ | ||
| CODENAME=$(. /etc/os-release && echo "$VERSION_CODENAME"); \ | ||
| install -d -m 0755 /usr/share/keyrings; \ | ||
| curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/keyrings/postgresql.gpg; \ | ||
| echo "deb [signed-by=/usr/share/keyrings/postgresql.gpg] https://apt.postgresql.org/pub/repos/apt ${CODENAME}-pgdg main" > /etc/apt/sources.list.d/pgdg.list; \ | ||
| apt-get update; \ | ||
| PG_MAJOR=$(pg_config --version | sed 's/^PostgreSQL \([0-9]\+\).*/\1/'); \ | ||
| apt-get install -y --no-install-recommends \ | ||
| postgresql-${PG_MAJOR}-pgvector \ | ||
| make \ | ||
| bash; \ | ||
| rm -rf /var/lib/apt/lists/* |
This file contains hidden or 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 @@ | ||
| ARG BASE=postgres | ||
| ARG BASE_VERSION=13.3-alpine | ||
| FROM ${BASE}:${BASE_VERSION} | ||
|
|
||
| LABEL org.opencontainers.image.source="https://github.com/launchql/launchql" | ||
| ARG BASE | ||
| ARG BASE_VERSION | ||
| ARG PGVECTOR_REF="v0.8.1" | ||
| ENV BASE_VERSION=${BASE_VERSION} | ||
| ENV PGVECTOR_REF=${PGVECTOR_REF} | ||
|
|
||
| # Alpine build (kept as a backup variant) | ||
| RUN set -eux; \ | ||
| : "${BASE_VERSION:?BASE_VERSION not set}"; \ | ||
| apk add --no-cache --virtual .build-deps git build-base bash make curl ca-certificates; \ | ||
| LLVM_CFG=$(pg_config --configure | tr ' ' '\n' | sed -n 's/^LLVM_CONFIG=\(.*\)$/\1/p' | tr -d '\"\'\'' ); \ | ||
| [ -n "${LLVM_CFG}" ] || { echo "Server not built with LLVM (LLVM_CONFIG missing)" >&2; exit 1; }; \ | ||
| LLVM_VER=$(echo "${LLVM_CFG}" | sed -E 's#.*/llvm-?([0-9]+)/.*#\1#'); \ | ||
| [ -n "${LLVM_VER}" ] || { echo "Could not determine LLVM version from: ${LLVM_CFG}" >&2; exit 1; }; \ | ||
| apk add --no-cache --virtual .clang \ | ||
| "clang${LLVM_VER}" \ | ||
| "llvm${LLVM_VER}" \ | ||
| "llvm${LLVM_VER}-libs" \ | ||
| "llvm${LLVM_VER}-linker-tools"; \ | ||
| git clone --quiet --depth 1 --branch "${PGVECTOR_REF}" https://github.com/pgvector/pgvector.git; \ | ||
| cd pgvector && make && make install; \ | ||
| cd .. && rm -rf pgvector; \ | ||
| apk del .clang .build-deps | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.