bpandey23 commited on
Commit
16a3198
1 Parent(s): 0a5ecea

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -31
Dockerfile CHANGED
@@ -1,38 +1,33 @@
1
- # Use the latest Ubuntu image as the base
2
- FROM ubuntu:latest
3
-
4
- # Install necessary packages
5
- RUN apt-get update && apt-get install -y \
6
- curl \
7
- wget \
8
- unzip \
 
9
  git \
10
- python3-pip \
11
- libmagic-dev \
12
- lsb-release \
13
- lsof \
14
- postgresql \
15
- gnupg
16
-
17
- # Install the PostgreSQL 16 repository key
18
- RUN curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
19
-
20
- # Install PostgreSQL 16 client and server
21
- RUN apt-get update && apt-get install -y postgresql-client-16 postgresql-server-dev-16
22
 
23
- # Create the foobar user and group
24
- RUN groupadd -r foobar && useradd -r -g foobar foobar
 
25
 
26
- # Create the PostgreSQL data directory and set permissions
27
- RUN mkdir -p /var/lib/postgresql/data && \
28
- chown -R foobar:foobar /var/lib/postgresql/data
 
 
29
 
30
- # Copy the entrypoint script to the container
31
- COPY entrypoint.sh /usr/local/bin/
32
- RUN chmod +x /usr/local/bin/entrypoint.sh
 
33
 
34
- # Expose the default PostgreSQL port
35
  EXPOSE 5432
36
 
37
- # Set the ENTRYPOINT to the entrypoint script
38
- ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
 
1
+ FROM ubuntu:20.04
2
+
3
+ # Install dependencies
4
+ RUN apt-get update && apt-get install -y \
5
+ build-essential \
6
+ libreadline-dev \
7
+ zlib1g-dev \
8
+ libssl-dev \
9
+ libpq-dev \
10
  git \
11
+ wget \
12
+ ca-certificates
 
 
 
 
 
 
 
 
 
 
13
 
14
+ # Download and extract PostgreSQL source code
15
+ RUN wget https://ftp.postgresql.org/pub/source/v14.1/postgresql-14.1.tar.gz
16
+ RUN tar -xzf postgresql-14.1.tar.gz
17
 
18
+ # Configure and build PostgreSQL
19
+ WORKDIR /postgresql-14.1
20
+ RUN ./configure
21
+ RUN make
22
+ RUN make install
23
 
24
+ # Set environment variables
25
+ ENV POSTGRES_DB=mydb
26
+ ENV POSTGRES_USER=myuser
27
+ ENV POSTGRES_PASSWORD=mypassword
28
 
29
+ # Expose the PostgreSQL port
30
  EXPOSE 5432
31
 
32
+ # Start the PostgreSQL server
33
+ CMD ["postgres", "-D", "/usr/local/pgsql/data"]