mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-05 12:32:54 +00:00
It's used by e2e CI. Building Dockerfile.compute-node will take unreasonable ammount of time without v2 runners. TODO: remove once cloud repo CI is moved to v2 runners.
88 lines
2.7 KiB
Docker
88 lines
2.7 KiB
Docker
#
|
|
# Legacy version of the Dockerfile for the compute node.
|
|
# Used by e2e CI. Building Dockerfile.compute-node will take
|
|
# unreasonable ammount of time without v2 runners.
|
|
#
|
|
# TODO: remove once cloud repo CI is moved to v2 runners.
|
|
#
|
|
|
|
|
|
# Allow specifiyng different compute-tools tag and image repo, so we are
|
|
# able to use different images
|
|
ARG REPOSITORY=369495373322.dkr.ecr.eu-central-1.amazonaws.com
|
|
ARG IMAGE=compute-tools
|
|
ARG TAG=latest
|
|
|
|
#
|
|
# Image with pre-built tools
|
|
#
|
|
FROM $REPOSITORY/$IMAGE:$TAG AS compute-deps
|
|
# Only to get ready compute_ctl binary as deppendency
|
|
|
|
#
|
|
# Image with Postgres build deps
|
|
#
|
|
FROM debian:buster-slim AS build-deps
|
|
|
|
RUN apt-get update && apt-get -yq install automake libtool build-essential bison flex libreadline-dev zlib1g-dev libxml2-dev \
|
|
libcurl4-openssl-dev libossp-uuid-dev
|
|
|
|
#
|
|
# Image with built Postgres
|
|
#
|
|
FROM build-deps AS pg-build
|
|
|
|
# Add user postgres
|
|
RUN adduser postgres
|
|
RUN mkdir /pg && chown postgres:postgres /pg
|
|
|
|
# Copy source files
|
|
COPY ./vendor/postgres /pg/
|
|
COPY ./pgxn /pg/
|
|
|
|
# Build and install Postgres locally
|
|
RUN mkdir /pg/compute_build && cd /pg/compute_build && \
|
|
../configure CFLAGS='-O2 -g3' --prefix=$(pwd)/postgres_bin --enable-debug --with-uuid=ossp && \
|
|
# Install main binaries and contribs
|
|
make MAKELEVEL=0 -j $(getconf _NPROCESSORS_ONLN) -s install && \
|
|
make MAKELEVEL=0 -j $(getconf _NPROCESSORS_ONLN) -s -C contrib/ install && \
|
|
# Install headers
|
|
make MAKELEVEL=0 -j $(getconf _NPROCESSORS_ONLN) -s -C src/include install
|
|
|
|
# Install neon contrib
|
|
RUN make MAKELEVEL=0 PG_CONFIG=/pg/compute_build/postgres_bin/bin/pg_config -j $(getconf _NPROCESSORS_ONLN) -C /pg/neon install
|
|
|
|
USER postgres
|
|
WORKDIR /pg
|
|
|
|
#
|
|
# Final compute node image to be exported
|
|
#
|
|
FROM debian:buster-slim
|
|
|
|
# libreadline-dev is required to run psql
|
|
RUN apt-get update && apt-get -yq install libreadline-dev libossp-uuid-dev
|
|
|
|
# Add user postgres
|
|
RUN mkdir /var/db && useradd -m -d /var/db/postgres postgres && \
|
|
echo "postgres:test_console_pass" | chpasswd && \
|
|
mkdir /var/db/postgres/compute && mkdir /var/db/postgres/specs && \
|
|
chown -R postgres:postgres /var/db/postgres && \
|
|
chmod 0750 /var/db/postgres/compute
|
|
|
|
# Copy ready Postgres binaries
|
|
COPY --from=pg-build /pg/compute_build/postgres_bin /usr/local
|
|
|
|
# Copy binaries from compute-tools
|
|
COPY --from=compute-deps /usr/local/bin/compute_ctl /usr/local/bin/compute_ctl
|
|
|
|
# XXX: temporary symlink for compatibility with old control-plane
|
|
RUN ln -s /usr/local/bin/compute_ctl /usr/local/bin/zenith_ctl
|
|
|
|
# Add postgres shared objects to the search path
|
|
RUN echo '/usr/local/lib' >> /etc/ld.so.conf && /sbin/ldconfig
|
|
|
|
USER postgres
|
|
|
|
ENTRYPOINT ["/usr/local/bin/compute_ctl"]
|