From bccd5d233007f11ee6d22a6120493b24daaab809 Mon Sep 17 00:00:00 2001 From: 100ask Date: Wed, 29 Nov 2023 03:45:05 -0500 Subject: [PATCH 1/6] feat(dockerfile):update dockerfile support riscv64 --- .github/workflows/container.yml | 2 +- Dockerfile | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 6cea02b..24d8558 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -168,7 +168,7 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} builder: ${{ steps.buildx.outputs.name }} - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64,linux/riscv64 cache-from: type=gha cache-to: type=gha,mode=max file: Dockerfile diff --git a/Dockerfile b/Dockerfile index 4ea371e..ceb5ffc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,17 @@ -FROM postgres:12.16-alpine3.18 +FROM xfan1024/openeuler:23.03-light -RUN apk --no-cache add tzdata dos2unix +RUN mkdir /tools +WORKDIR /tools + +RUN yum -y install wget make gcc readline-devel zlib-devel util-linux tzdata dos2unix + +RUN wget https://ftp.postgresql.org/pub/source/v12.16/postgresql-12.16.tar.gz +RUN tar -xvf postgresql-12.16.tar.gz + +WORKDIR /tools/postgresql-12.16 +RUN ./configure --prefix=/usr/local/postgresql\ + && make -j16\ + && make install ENV TZ=Asia/Shanghai @@ -12,4 +23,4 @@ RUN dos2unix -k /usr/local/bin/update-pg-password.sh /usr/local/bin/docker-entry RUN chmod +x /usr/local/bin/docker-entrypoint.sh RUN chmod +x /usr/local/bin/update-pg-password.sh -RUN chmod +x /docker-entrypoint-initdb.d/10_eulixspace.sh \ No newline at end of file +RUN chmod +x /docker-entrypoint-initdb.d/10_eulixspace.sh From 4a099eb6061b0abecb6092641d0c712c2aae9bc2 Mon Sep 17 00:00:00 2001 From: 100ask Date: Wed, 24 Jan 2024 22:51:17 -0500 Subject: [PATCH 2/6] support postgresql service --- Dockerfile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Dockerfile b/Dockerfile index ceb5ffc..5d316a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,17 @@ RUN ./configure --prefix=/usr/local/postgresql\ && make -j16\ && make install +# 创建postgres用户和数据目录 +RUN useradd postgres\ + && mkdir /usr/local/postgresql/data\ + && chown -R postgres /usr/local/postgresql +# 初始化数据库并启动PostgreSQL服务 +USER postgres +RUN /usr/local/postgresql/bin/initdb -D /usr/local/postgresql/data\ + && /usr/local/postgresql/bin/pg_ctl -D /usr/local/postgresql/data start\ + && /usr/local/postgresql/bin/createdb test\ + && /usr/local/postgresql/bin/psql test + ENV TZ=Asia/Shanghai COPY ./update-pg-password.sh /usr/local/bin From 0f950408f8fbc0ac777978f0d3b91aa21e7fc1a0 Mon Sep 17 00:00:00 2001 From: 100ask Date: Thu, 25 Jan 2024 00:17:35 -0500 Subject: [PATCH 3/6] support postgresql service --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5d316a1..8535803 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,13 +16,13 @@ RUN ./configure --prefix=/usr/local/postgresql\ # 创建postgres用户和数据目录 RUN useradd postgres\ && mkdir /usr/local/postgresql/data\ - && chown -R postgres /usr/local/postgresql + && chown -R postgres /usr/local/postgresql\ + && chown -R postgres /tools + # 初始化数据库并启动PostgreSQL服务 USER postgres RUN /usr/local/postgresql/bin/initdb -D /usr/local/postgresql/data\ - && /usr/local/postgresql/bin/pg_ctl -D /usr/local/postgresql/data start\ - && /usr/local/postgresql/bin/createdb test\ - && /usr/local/postgresql/bin/psql test + && /usr/local/postgresql/bin/pg_ctl -D /usr/local/postgresql/data start ENV TZ=Asia/Shanghai From 6bea5b9ea40150e7b7ed52f99d651c58245427e5 Mon Sep 17 00:00:00 2001 From: 100ask Date: Thu, 25 Jan 2024 00:46:12 -0500 Subject: [PATCH 4/6] support postgresql service --- Dockerfile | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8535803..ad38fb5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,11 +3,26 @@ FROM xfan1024/openeuler:23.03-light RUN mkdir /tools WORKDIR /tools +# 安装依赖 RUN yum -y install wget make gcc readline-devel zlib-devel util-linux tzdata dos2unix +ENV TZ=Asia/Shanghai + +COPY ./update-pg-password.sh /usr/local/bin +COPY eulixspace_pgsql_init.sh /docker-entrypoint-initdb.d/10_eulixspace.sh +COPY docker-entrypoint.sh /usr/local/bin + +RUN dos2unix -k /usr/local/bin/update-pg-password.sh /usr/local/bin/docker-entrypoint.sh /docker-entrypoint-initdb.d/10_eulixspace.sh + +RUN chmod +x /usr/local/bin/docker-entrypoint.sh +RUN chmod +x /usr/local/bin/update-pg-password.sh +RUN chmod +x /docker-entrypoint-initdb.d/10_eulixspace.sh + +# 下载并解压PostgreSQL源码 RUN wget https://ftp.postgresql.org/pub/source/v12.16/postgresql-12.16.tar.gz RUN tar -xvf postgresql-12.16.tar.gz +# 编译和安装PostgreSQL WORKDIR /tools/postgresql-12.16 RUN ./configure --prefix=/usr/local/postgresql\ && make -j16\ @@ -22,16 +37,4 @@ RUN useradd postgres\ # 初始化数据库并启动PostgreSQL服务 USER postgres RUN /usr/local/postgresql/bin/initdb -D /usr/local/postgresql/data\ - && /usr/local/postgresql/bin/pg_ctl -D /usr/local/postgresql/data start - -ENV TZ=Asia/Shanghai - -COPY ./update-pg-password.sh /usr/local/bin -COPY eulixspace_pgsql_init.sh /docker-entrypoint-initdb.d/10_eulixspace.sh -COPY docker-entrypoint.sh /usr/local/bin - -RUN dos2unix -k /usr/local/bin/update-pg-password.sh /usr/local/bin/docker-entrypoint.sh /docker-entrypoint-initdb.d/10_eulixspace.sh - -RUN chmod +x /usr/local/bin/docker-entrypoint.sh -RUN chmod +x /usr/local/bin/update-pg-password.sh -RUN chmod +x /docker-entrypoint-initdb.d/10_eulixspace.sh + && /usr/local/postgresql/bin/pg_ctl -D /usr/local/postgresql/data start \ No newline at end of file From d9db04fdc39494304186e486006017a755a37041 Mon Sep 17 00:00:00 2001 From: 100ask Date: Thu, 25 Jan 2024 09:30:09 -0500 Subject: [PATCH 5/6] support yum install postgresql --- Dockerfile | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index ad38fb5..4578ab3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,9 @@ FROM xfan1024/openeuler:23.03-light - RUN mkdir /tools WORKDIR /tools # 安装依赖 -RUN yum -y install wget make gcc readline-devel zlib-devel util-linux tzdata dos2unix +RUN yum -y install util-linux dos2unix ENV TZ=Asia/Shanghai @@ -18,23 +17,12 @@ RUN chmod +x /usr/local/bin/docker-entrypoint.sh RUN chmod +x /usr/local/bin/update-pg-password.sh RUN chmod +x /docker-entrypoint-initdb.d/10_eulixspace.sh -# 下载并解压PostgreSQL源码 -RUN wget https://ftp.postgresql.org/pub/source/v12.16/postgresql-12.16.tar.gz -RUN tar -xvf postgresql-12.16.tar.gz - -# 编译和安装PostgreSQL -WORKDIR /tools/postgresql-12.16 -RUN ./configure --prefix=/usr/local/postgresql\ - && make -j16\ - && make install -# 创建postgres用户和数据目录 -RUN useradd postgres\ - && mkdir /usr/local/postgresql/data\ - && chown -R postgres /usr/local/postgresql\ - && chown -R postgres /tools +RUN yum -y install postgresql postgresql-server \ + &&mkdir /data\ + &&chown -R postgres /data\ + &&chown -R postgres /tools -# 初始化数据库并启动PostgreSQL服务 USER postgres -RUN /usr/local/postgresql/bin/initdb -D /usr/local/postgresql/data\ - && /usr/local/postgresql/bin/pg_ctl -D /usr/local/postgresql/data start \ No newline at end of file +RUN initdb -D /data \ + &&pg_ctl -D /data/ -l /data/logfile start \ No newline at end of file From a44c1fddb5a0fdbdca4275b531e77e3789e8cfa7 Mon Sep 17 00:00:00 2001 From: 100ask Date: Thu, 25 Jan 2024 21:15:43 -0500 Subject: [PATCH 6/6] fix postgresql start --- Dockerfile | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4578ab3..381f779 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,11 @@ WORKDIR /tools # 安装依赖 RUN yum -y install util-linux dos2unix +RUN yum -y install postgresql postgresql-server \ + &&mkdir /data\ + &&chown -R postgres /data\ + &&chown -R postgres /tools + ENV TZ=Asia/Shanghai COPY ./update-pg-password.sh /usr/local/bin @@ -15,14 +20,4 @@ RUN dos2unix -k /usr/local/bin/update-pg-password.sh /usr/local/bin/docker-entry RUN chmod +x /usr/local/bin/docker-entrypoint.sh RUN chmod +x /usr/local/bin/update-pg-password.sh -RUN chmod +x /docker-entrypoint-initdb.d/10_eulixspace.sh - - -RUN yum -y install postgresql postgresql-server \ - &&mkdir /data\ - &&chown -R postgres /data\ - &&chown -R postgres /tools - -USER postgres -RUN initdb -D /data \ - &&pg_ctl -D /data/ -l /data/logfile start \ No newline at end of file +RUN chmod +x /docker-entrypoint-initdb.d/10_eulixspace.sh \ No newline at end of file