DockerPostgresMigration/Dockerfile

36 lines
1.2 KiB
Docker
Raw Permalink Normal View History

2024-12-05 15:59:05 +00:00
FROM ubuntu:noble AS build17
RUN apt update && apt upgrade -y && apt install -y wget curl tar build-essential libreadline-dev zlib1g-dev flex bison libicu-dev pkg-config
RUN wget https://ftp.postgresql.org/pub/source/v17.2/postgresql-17.2.tar.gz -O pg17.tar.gz
RUN tar -xf pg17.tar.gz
RUN cd postgresql* && ./configure --prefix=/postgres/17 && make world-bin && make install
FROM ubuntu:noble AS build16
RUN apt update && apt upgrade -y && apt install -y wget curl tar build-essential libreadline-dev zlib1g-dev flex bison libicu-dev pkg-config
RUN wget https://ftp.postgresql.org/pub/source/v16.6/postgresql-16.6.tar.gz -O pg16.tar.gz
RUN tar -xf pg16.tar.gz
RUN cd postgresql* && ./configure --prefix=/postgres/16 && make world-bin && make install
FROM ubuntu:noble
2024-12-06 10:32:50 +00:00
RUN apt update && apt install -y \
libicu74 \
libreadline8t64 \
curl \
wget \
nano \
locales \
&& rm -rf /var/lib/apt/lists/*
RUN localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG=en_US.utf8
ENV POSTGRES_USER=postgres
2024-12-05 15:59:05 +00:00
COPY --from=build17 /postgres/17 /postgres/17
2024-12-06 10:32:50 +00:00
COPY --from=build16 /postgres/16 /postgres/16
COPY migrate.sh /migrate.sh
RUN chmod +x migrate.sh
CMD ["/migrate.sh"]