diff --git a/README.md b/README.md index 439ff3a..028cec4 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,15 @@ sudo yum install libmetalink yum install libuuid-devel ``` +###### Build docker images + +``` +docker build -f docker/Dockerfile.pg-alpine --build-arg POSTGRES_VERSION=13 . + +docker build -f docker/Dockerfile.pg --build-arg POSTGRES_VERSION=13 . +``` + + Usage ----- diff --git a/docker/Dockerfile.pg b/docker/Dockerfile.pg new file mode 100644 index 0000000..9b190a0 --- /dev/null +++ b/docker/Dockerfile.pg @@ -0,0 +1,20 @@ +ARG POSTGRES_VERSION +FROM postgres:${POSTGRES_VERSION} as build + +ARG POSTGRES_VERSION +RUN apt update && apt install -y cmake build-essential uuid-dev postgresql-server-dev-${POSTGRES_VERSION} libcurl4-openssl-dev pkg-config + +ADD . /clickhouse-fdw-src +RUN rm -rf /clickhouse-fdw-src/build +WORKDIR /clickhouse-fdw-src + +RUN mkdir -p build && cd build && cmake .. && make install + +ARG POSTGRES_VERSION +FROM postgres:${POSTGRES_VERSION} + +ARG POSTGRES_VERSION +RUN apt update && apt install -y libcurl4 +COPY --from=build /usr/lib/postgresql/${POSTGRES_VERSION}/lib/* /usr/lib/postgresql/${POSTGRES_VERSION}/lib/ +COPY --from=build /usr/share/postgresql/${POSTGRES_VERSION}/extension/* /usr/share/postgresql/${POSTGRES_VERSION}/extension/ + diff --git a/docker/Dockerfile.pg-alpine b/docker/Dockerfile.pg-alpine new file mode 100644 index 0000000..5f6b9bc --- /dev/null +++ b/docker/Dockerfile.pg-alpine @@ -0,0 +1,17 @@ +ARG POSTGRES_VERSION +FROM postgres:${POSTGRES_VERSION}-alpine as build + +# RUN apk --no-cache add clang-analyzer make musl-dev gcc g++ openssl-dev cmake curl-dev util-linux-dev +RUN apk --no-cache add make musl-dev gcc g++ openssl-dev cmake curl-dev util-linux-dev + +ADD . /clickhouse-fdw-src +RUN rm -rf /clickhouse-fdw-src/build +WORKDIR /clickhouse-fdw-src + +RUN mkdir -p build && cd build && cmake .. && make install + +FROM postgres:${POSTGRES_VERSION}-alpine +RUN apk --no-cache add libcurl +COPY --from=build /usr/local/lib/postgresql/* /usr/local/lib/postgresql/ +COPY --from=build /usr/local/share/postgresql/extension/* /usr/local/share/postgresql/extension/ +