Skip to content

Commit

Permalink
Debug docker
Browse files Browse the repository at this point in the history
  • Loading branch information
svenklemm committed Feb 11, 2025
1 parent 23807cb commit 92ca50d
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 75 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
default: false
env:
ORG: timescale #timescaledev
TS_VERSION: ${{ github.event.inputs.version || '2.17.0' }}
TS_VERSION: ${{ github.event.inputs.version || '2.18.1' }}
jobs:

# Build multi-arch TimescaleDB images for both TSL and OSS code.
Expand All @@ -29,8 +29,10 @@ jobs:
strategy:
fail-fast: false
matrix:
pg: [14, 15, 16, 17]
oss: [ "", "-oss" ]
pg: [17]
# pg: [14, 15, 16, 17]
oss: [ "" ]
# oss: [ "", "-oss" ]
steps:
- uses: actions/checkout@v4

Expand Down
148 changes: 77 additions & 71 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ ARG ALPINE_VERSION
############################
# Build tools binaries in separate image
############################
ARG GO_VERSION=1.22.4
FROM golang:${GO_VERSION}-alpine AS tools

ENV TOOLS_VERSION 0.8.1

RUN apk update && apk add --no-cache git gcc musl-dev \
&& go install github.com/timescale/timescaledb-tune/cmd/timescaledb-tune@latest \
&& go install github.com/timescale/timescaledb-parallel-copy/cmd/timescaledb-parallel-copy@latest
#ARG GO_VERSION=1.22.4
#FROM golang:${GO_VERSION}-alpine AS tools
#
#ENV TOOLS_VERSION 0.8.1
#
#RUN apk update && apk add --no-cache git gcc musl-dev
# && go install github.com/timescale/timescaledb-tune/cmd/timescaledb-tune@latest
# && go install github.com/timescale/timescaledb-parallel-copy/cmd/timescaledb-parallel-copy@v0.9.0

############################
# Grab old versions from previous version
Expand All @@ -34,75 +34,81 @@ ARG OSS_ONLY

LABEL maintainer="Timescale https://www.timescale.com"

# ARG ALPINE_VERSION
# RUN echo "https://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/community/" >> /etc/apk/repositories

ARG PG_VERSION
RUN set -ex; \
apk update; \
apk add --no-cache \
postgresql${PG_VERSION}-plpython3;

ARG PGVECTOR_VERSION
ARG PG_VERSION
ARG CLANG_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;
# ARG PG_VERSION
# RUN set -ex; \
# apk update; \
# apk add --no-cache \
# postgresql${PG_VERSION}-plpython3;
#
# ARG PGVECTOR_VERSION
# ARG PG_VERSION
# ARG CLANG_VERSION
# RUN set -ex; \
# if [ "$PG_MAJOR_VERSION" -ge 16 ]; then \
# 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; \
# fi

# install pgai only on pg16+ and not on 32 bit arm
ARG PGAI_VERSION
ARG PG_MAJOR_VERSION
ARG TARGETARCH
RUN set -ex; \
if [ "$PG_MAJOR_VERSION" -ge 16 ] && [ "$TARGETARCH" != "arm" ]; then \
apk update; \
# install shared libraries needed at runtime
apk add libarrow libparquet geos; \
# install required dependencies for building pyarrow from source
apk add --no-cache --virtual .pgai-deps \
git \
build-base \
cargo \
cmake \
python3-dev \
py3-pip \
apache-arrow-dev \
geos-dev; \
# using uv reduces space required for pgai's dependencies \
python3 -m pip install uv --break-system-packages; \
git clone --branch ${PGAI_VERSION} https://github.com/timescale/pgai.git /build/pgai; \
cd /build/pgai; \
# note: this is a hack. pyarrow will be built from source, so must be pinned to this arrow version \
echo "pyarrow==$(pkg-config --modversion arrow)" > constraints.txt; \
export PIP_CONSTRAINT=$(pwd)/constraints.txt; \
if [ "$TARGETARCH" == "386" ]; then \
# note: pinned because pandas 2.2.0-2.2.3 on i386 is affected by https://github.com/pandas-dev/pandas/issues/59905 \
echo "pandas==2.1.4" >> constraints.txt; \
export PIP_CONSTRAINT=$(pwd)/constraints.txt; \
# note: no prebuilt binaries for pillow on i386 \
apk add --no-cache --virtual .pgai-deps-386 \
jpeg-dev \
zlib-dev; \
fi; \
PG_BIN="/usr/local/bin" PG_MAJOR=${PG_MAJOR_VERSION} ./projects/extension/build.py install; \
if [ "$TARGETARCH" == "386" ]; then apk del .pgai-deps-386; fi; \
apk del .pgai-deps; \
fi
## install pgai only on pg16+ and not on 32 bit arm
#ARG PGAI_VERSION
#ARG PG_MAJOR_VERSION
#ARG TARGETARCH
#RUN set -ex; \
# if [ "$PG_MAJOR_VERSION" -ge 16 ] && [ "$TARGETARCH" == "amd64" ]; then \
# apk update; \
# # install shared libraries needed at runtime
# apk add libarrow libparquet geos; \
# # install required dependencies for building pyarrow from source
# apk add --no-cache --virtual .pgai-deps \
# git \
# build-base \
# cargo \
# cmake \
# python3-dev \
# py3-pip \
# apache-arrow-dev \
# geos-dev; \
# # using uv reduces space required for pgai's dependencies \
# python3 -m pip install uv --break-system-packages; \
# git clone --branch ${PGAI_VERSION} https://github.com/timescale/pgai.git /build/pgai; \
# cd /build/pgai; \
# # note: this is a hack. pyarrow will be built from source, so must be pinned to this arrow version \
# echo "pyarrow==$(pkg-config --modversion arrow)" > constraints.txt; \
# export PIP_CONSTRAINT=$(pwd)/constraints.txt; \
# if [ "$TARGETARCH" == "386" ]; then \
# # note: pinned because pandas 2.2.0-2.2.3 on i386 is affected by https://github.com/pandas-dev/pandas/issues/59905 \
# echo "pandas==2.1.4" >> constraints.txt; \
# export PIP_CONSTRAINT=$(pwd)/constraints.txt; \
# # note: no prebuilt binaries for pillow on i386 \
# apk add --no-cache --virtual .pgai-deps-386 \
# jpeg-dev \
# zlib-dev; \
# fi; \
# PG_BIN="/usr/local/bin" PG_MAJOR=${PG_MAJOR_VERSION} ./projects/extension/build.py install; \
# if [ "$TARGETARCH" == "386" ]; then apk del .pgai-deps-386; fi; \
# apk del .pgai-deps; \
# fi

COPY docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d/
COPY --from=tools /go/bin/* /usr/local/bin/
#COPY --from=tools /go/bin/* /usr/local/bin/
COPY --from=oldversions /usr/local/lib/postgresql/timescaledb-*.so /usr/local/lib/postgresql/
COPY --from=oldversions /usr/local/share/postgresql/extension/timescaledb--*.sql /usr/local/share/postgresql/extension/
COPY --from=oldversions /usr/local/bin/timescaledb-tune /usr/local/share/postgresql/extension/
COPY --from=oldversions /usr/local/bin/timescaledb-parallel-copy /usr/local/share/postgresql/extension/

ARG TS_VERSION
RUN set -ex \
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 All @@ -18,7 +18,10 @@ PREV_TS_IMAGE="timescale/timescaledb:$(PREV_TS_VERSION)-pg$(PG_VER_NUMBER)$(PREV
PREV_IMAGE=$(shell if docker pull $(PREV_TS_IMAGE) >/dev/null; then echo "$(PREV_TS_IMAGE)"; else echo "postgres:$(PG_VER_NUMBER)-alpine"; fi )
# Beta releases should not be tagged as latest, so BETA is used to track.
BETA=$(findstring rc,$(TS_VERSION))
#PLATFORM=linux/amd64,linux/arm/v6,linux/arm/v7
PLATFORM=linux/arm64
PLATFORM=linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
PLATFORM=linux/amd64,linux/arm64

# PUSH_MULTI can be set to nothing for dry-run without pushing during multi-arch build
PUSH_MULTI=--push
Expand Down

0 comments on commit 92ca50d

Please sign in to comment.