-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathDockerfile.postgresql
More file actions
54 lines (47 loc) · 2.02 KB
/
Dockerfile.postgresql
File metadata and controls
54 lines (47 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Copyright (C) 2024 Tim Bastin, l3montree GmbH
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Use the official PostgreSQL image as a base
FROM postgres:16.9-bookworm@sha256:fec2740c517838d4f582e48a8a9a1cb51082af3dcae59e9b12a66ec262302b97
# Install the build dependencies
RUN apt-get update && apt-get install -y \
git \
build-essential \
postgresql-server-dev-16 \
postgresql-server-dev-all && \
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
locale-gen en_US.UTF-8
# Set environment variables for locale
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
# Clone the pg-semver repository
RUN git clone https://github.com/theory/pg-semver.git /pg-semver
# Build and install pg-semver with proper PostgreSQL version
RUN cd /pg-semver && \
export PG_CONFIG=/usr/lib/postgresql/16/bin/pg_config && \
export PATH="/usr/lib/postgresql/16/bin:$PATH" && \
make clean && \
make && \
make install && \
# Verify the extension files are installed correctly for PostgreSQL 16
echo "Checking installed semver files:" && \
find /usr -name "*semver*" -type f 2>/dev/null
# Clean up the build dependencies to keep the image size down
RUN apt-get remove -y git build-essential postgresql-server-dev-all && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Set the default command to run when starting the container
CMD ["postgres"]