Skip to content
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

Docker workflow improvements #298

Merged
merged 1 commit into from
Feb 24, 2025
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
22 changes: 12 additions & 10 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches: [ release_docker, dev-build ]
pull_request:
paths: .github/workflows/docker-image.yml
workflow_dispatch:
inputs:
version:
Expand All @@ -15,15 +14,17 @@ on:
description: 'Do not tag the published images as latest'
type: boolean
required: false
default: false
default: true

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
ORG: timescale #timescaledev
TS_VERSION: ${{ github.event.inputs.version || '2.18.1' }}
ORG: timescaledev #timescaledev
TS_VERSION: ${{ github.event.inputs.version || '2.18.2' }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:

# Build multi-arch TimescaleDB images for both TSL and OSS code.
Expand Down Expand Up @@ -65,13 +66,14 @@ jobs:

- name: Build and push multi-platform Docker image for TimescaleDB
run: |
if [ "${{ github.event_name }}" == "pull_request" ]
then
export ORG=timescaledev
fi
if [ "${{ github.event.inputs.no_tag_latest }}" == "true" ]
export BETA=1
if [ "${{ github.event.inputs.no_tag_latest }}" == "false" ]
then
export BETA=1
if [[ "${BRANCH_NAME}" =~ ^(main|release_docker)$ ]];
then
export ORG=timescale
fi
export BETA=0
fi
make multi${{ matrix.oss }} ORG=$ORG PG_VER=pg${{ matrix.pg }} \
TS_VERSION=$TS_VERSION PREV_EXTRA="${{ matrix.oss }}" BETA=$BETA
Expand Down
37 changes: 23 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,37 @@ LABEL maintainer="Timescale https://www.timescale.com"


ARG PG_VERSION
ARG PG_MAJOR_VERSION
ARG ALPINE_VERSION
RUN set -ex; \
echo "https://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/community/" >> /etc/apk/repositories; \
apk update; \
apk add --no-cache \
postgresql${PG_VERSION}-plpython3;
if [ "$PG_MAJOR_VERSION" -ge 16 ] ; then \
apk add --no-cache postgresql${PG_VERSION}-plpython3; \
fi

ARG PGVECTOR_VERSION
ARG PG_VERSION
ARG CLANG_VERSION
ARG PG_MAJOR_VERSION
RUN set -ex; \
apk update; \
apk add --no-cache --virtual .vector-deps \
postgresql${PG_VERSION}-dev \
git \
build-base \
clang${CLANG_VERSION} \
llvm${CLANG_VERSION}-dev \
llvm${CLANG_VERSION}; \
git clone --branch ${PGVECTOR_VERSION} https://github.com/pgvector/pgvector.git /build/pgvector; \
cd /build/pgvector; \
make; \
make install; \
apk del .vector-deps;
if [ "$PG_MAJOR_VERSION" -ge 17 ] ; then \
apk add --no-cache postgresql-pgvector; \
else \
apk add --no-cache --virtual .vector-deps \
postgresql${PG_VERSION}-dev \
git \
build-base \
clang${CLANG_VERSION} \
llvm${CLANG_VERSION}-dev \
llvm${CLANG_VERSION}; \
git clone --branch ${PGVECTOR_VERSION} https://github.com/pgvector/pgvector.git /build/pgvector; \
cd /build/pgvector; \
make; \
make install; \
apk del .vector-deps; \
fi

COPY docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d/
COPY --from=tools /go/bin/* /usr/local/bin/
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ NAME=timescaledb
# Default is to timescaledev to avoid unexpected push to the main repo
# Set ORG to timescale in the caller
ORG=timescaledev
PG_VER=pg16
PG_VER=pg17
PG_VER_NUMBER=$(shell echo $(PG_VER) | cut -c3-)
PG_MAJOR_VERSION=$(shell echo $(PG_VER_NUMBER) | cut -d. -f1)
ifeq ($(shell test $(PG_MAJOR_VERSION) -ge 16; echo $$?),0)
Expand Down Expand Up @@ -42,6 +42,8 @@ default: image
.multi_$(TS_VERSION)_$(PG_VER)_oss: Dockerfile
test -n "$(TS_VERSION)" # TS_VERSION
test -n "$(PREV_TS_VERSION)" # PREV_TS_VERSION
test -n "$(PREV_IMAGE)" # PREV_IMAGE
test -n "$(ALPINE_VERSION)" # ALPINE_VERSION
docker buildx create --platform $(PLATFORM) --name multibuild --use
docker buildx inspect multibuild --bootstrap
docker buildx build --platform $(PLATFORM) \
Expand All @@ -55,6 +57,7 @@ default: image
test -n "$(TS_VERSION)" # TS_VERSION
test -n "$(PREV_TS_VERSION)" # PREV_TS_VERSION
test -n "$(PREV_IMAGE)" # PREV_IMAGE
test -n "$(ALPINE_VERSION)" # ALPINE_VERSION
docker buildx create --platform $(PLATFORM) --name multibuild --use
docker buildx inspect multibuild --bootstrap
docker buildx build --platform $(PLATFORM) \
Expand Down
Loading