From 763da727ac7991bcd81750566e279ad7d88d4b4e Mon Sep 17 00:00:00 2001 From: ZacharyZcR <2903735704@qq.com> Date: Fri, 20 Dec 2024 19:35:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0Postgre=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E9=9D=B6=E5=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TestDocker/Postgre/Dockerfile | 14 ++++++++++++++ TestDocker/Postgre/README.md | 5 +++++ 2 files changed, 19 insertions(+) create mode 100644 TestDocker/Postgre/Dockerfile create mode 100644 TestDocker/Postgre/README.md diff --git a/TestDocker/Postgre/Dockerfile b/TestDocker/Postgre/Dockerfile new file mode 100644 index 0000000..5cc0085 --- /dev/null +++ b/TestDocker/Postgre/Dockerfile @@ -0,0 +1,14 @@ +# 使用PostgreSQL官方镜像 +FROM postgres:latest + +# 设置环境变量 +ENV POSTGRES_USER=postgres +ENV POSTGRES_PASSWORD=123456 +ENV POSTGRES_DB=mydb + +# 开放5432端口 +EXPOSE 5432 + +# 健康检查 +HEALTHCHECK --interval=30s --timeout=3s \ + CMD pg_isready -U postgres || exit 1 \ No newline at end of file diff --git a/TestDocker/Postgre/README.md b/TestDocker/Postgre/README.md new file mode 100644 index 0000000..69d9891 --- /dev/null +++ b/TestDocker/Postgre/README.md @@ -0,0 +1,5 @@ +docker build -t postgres-server . +docker run -d \ +-p 5432:5432 \ +--name postgres-container \ +postgres-server \ No newline at end of file