File size: 709 Bytes
16a3198
 
 
 
 
 
 
 
 
e8bc6b1
16a3198
 
cd5e0f7
16a3198
 
 
5d7f036
16a3198
 
 
 
 
2d6a7aa
16a3198
 
 
 
2d6a7aa
16a3198
7d32e22
2d6a7aa
16a3198
 
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
FROM ubuntu:20.04

# Install dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    libreadline-dev \
    zlib1g-dev \
    libssl-dev \
    libpq-dev \
    git \
    wget \
    ca-certificates

# Download and extract PostgreSQL source code
RUN wget https://ftp.postgresql.org/pub/source/v14.1/postgresql-14.1.tar.gz
RUN tar -xzf postgresql-14.1.tar.gz

# Configure and build PostgreSQL
WORKDIR /postgresql-14.1
RUN ./configure
RUN make
RUN make install

# Set environment variables
ENV POSTGRES_DB=mydb
ENV POSTGRES_USER=myuser
ENV POSTGRES_PASSWORD=mypassword

# Expose the PostgreSQL port
EXPOSE 5432

# Start the PostgreSQL server
CMD ["postgres", "-D", "/usr/local/pgsql/data"]