-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
23 lines (17 loc) · 1.04 KB
/
Dockerfile
File metadata and controls
23 lines (17 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Use the official PostgreSQL image
FROM postgres:18.1
# Update package lists, install netcat-openbsd (useful for waiting on network connections), and clean up apt cache
#RUN apt-get update && apt-get install -y netcat-openbsd && rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /var/lib/postgresql
RUN rm -rf data/*
# Copy SSL certificate files into the /certs/ directory in the container
COPY docker/postgres/certificates/server.pem docker/postgres/certificates/server.key docker/postgres/certificates/ca.pem /certs/
# Set ownership to the postgres user and restrict permissions on the private key for security
RUN chown postgres:postgres /certs/* && chmod 600 /certs/server.key
# Copy an initialization script that sets up SSL into the Docker entrypoint directory
# Scripts in this directory are executed when the container is initialized
COPY docker/postgres/scripts/config-ssl.sh /docker-entrypoint-initdb.d/
RUN chmod +x /docker-entrypoint-initdb.d/config-ssl.sh
# Expose the PostgreSQL default port to allow external connections
EXPOSE 5432