Podman_compose_BigData/postgres.Containerfile
2025-10-16 21:15:12 +09:00

40 lines
1.4 KiB
Plaintext

# postgres.Containerfile
# 1. 공식 postgres:17 이미지를 기반으로 시작합니다.
FROM docker.io/library/postgres:17
# 2. 패키지 설치를 위해 root 권한으로 전환합니다.
USER root
# 3. apt 패키지 및 Python 패키지 설치
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gnupg \
python3 python3-pip \
lsb-release && \
\
# PostgreSQL 저장소 추가
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /etc/apt/keyrings/postgresql-archive-keyring.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/postgresql-archive-keyring.gpg] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list > /dev/null && \
\
# 패키지 목록 업데이트 및 확장 기능들 설치
apt-get update && \
apt-get install -y --no-install-recommends \
postgresql-17-mysql-fdw \
postgresql-17-cron \
postgresql-plpython3-17 && \
\
# Python 패키지 설치
python3 -m pip install --no-cache-dir --break-system-packages korean-romanizer && \
\
# 설치 후 불필요한 파일 정리
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# 4. 보안을 위해 다시 postgres 사용자로 전환합니다.
USER postgres