diff --git a/docker/Dockerfile b/docker/Dockerfile index 45298538e..38c3dfbc5 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -16,15 +16,15 @@ # limitations under the License. # -FROM postgres:15 +# Build stage: Install necessary development tools for compilation and installation +FROM postgres:15 AS build RUN apt-get update \ && apt-get install -y --no-install-recommends --no-install-suggests \ bison \ build-essential \ flex \ - postgresql-server-dev-15 \ - locales + postgresql-server-dev-15 ENV LANG=en_US.UTF-8 ENV LC_COLLATE=en_US.UTF-8 @@ -40,6 +40,25 @@ WORKDIR /age RUN make && make install + +# Final stage: Create a final image by copying the files created in the build stage +FROM postgres:15 + +RUN apt-get update \ + && apt-get install -y --no-install-recommends --no-install-suggests \ + locales + +RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \ + && locale-gen \ + && update-locale LANG=en_US.UTF-8 + +ENV LANG=en_US.UTF-8 +ENV LC_COLLATE=en_US.UTF-8 +ENV LC_CTYPE=en_US.UTF-8 + +COPY --from=build /usr/lib/postgresql/15/lib/age.so /usr/lib/postgresql/15/lib/ +COPY --from=build /usr/share/postgresql/15/extension/age--1.5.0.sql /usr/share/postgresql/15/extension/ +COPY --from=build /usr/share/postgresql/15/extension/age.control /usr/share/postgresql/15/extension/ COPY docker/docker-entrypoint-initdb.d/00-create-extension-age.sql /docker-entrypoint-initdb.d/00-create-extension-age.sql CMD ["postgres", "-c", "shared_preload_libraries=age"] diff --git a/docker/hooks/build b/docker/hooks/build index bd347d906..584f6dd6e 100644 --- a/docker/hooks/build +++ b/docker/hooks/build @@ -1,4 +1,4 @@ #!/bin/bash -docker buildx create --name multiarch --use --platform linux/amd64,linux/arm64/v8 -docker buildx build ../ -t $IMAGE_NAME -f Dockerfile --platform linux/amd64,linux/arm64/v8 --push \ No newline at end of file +docker buildx create --name multiarch --use --platform linux/amd64 +docker buildx build ../ -t shinya11kato/age:pg15 -f Dockerfile --platform linux/amd64 --push --no-cache \ No newline at end of file