File size: 1,082 Bytes
7d32e22
 
9647270
e8bc6b1
 
 
 
 
 
 
 
 
 
 
0a5ecea
daeb470
193844b
 
 
cd5e0f7
 
 
5d7f036
 
 
cd5e0f7
 
5d7f036
2d6a7aa
7d32e22
 
 
2d6a7aa
7d32e22
 
2d6a7aa
7d32e22
 
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
# Use the latest Ubuntu image as the base
FROM ubuntu:latest

# Install necessary packages  
RUN apt-get update && apt-get install -y \  
    curl \
    wget \
    unzip \
    git \
    python3-pip \
    libmagic-dev \
    lsb-release \
    lsof \
    postgresql \
    gnupg

# Install the PostgreSQL 16 repository key
RUN curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg

# Install PostgreSQL 16 client and server
RUN apt-get update && apt-get install -y postgresql-client-16 postgresql-server-dev-16

# Create the foobar user and group
RUN groupadd -r foobar && useradd -r -g foobar foobar

# Create the PostgreSQL data directory and set permissions
RUN mkdir -p /var/lib/postgresql/data && \
    chown -R foobar:foobar /var/lib/postgresql/data

# Copy the entrypoint script to the container
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh

# Expose the default PostgreSQL port
EXPOSE 5432

# Set the ENTRYPOINT to the entrypoint script
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]