You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by GitBox <gi...@apache.org> on 2022/11/22 16:20:36 UTC

[GitHub] [age] sep2 opened a new issue, #362: Reduce docker image size with multi-stage build

sep2 opened a new issue, #362:
URL: https://github.com/apache/age/issues/362

   **Is your feature request related to a problem? Please describe.**
   The docker image is too large compared to a postgres:11 image.
   
   apache/age:latest   ---   801MB
   postgres:11 --- 284MB
   
   **Describe the solution you'd like**
   Reduce the image size using multi-stage build as described here https://docs.docker.com/build/building/multi-stage/
   
   **Additional context**
   I'm not familar with the build process and what is incluced in the build output files, if you could give me a little details on what should be copied out & to where the output files need to be placed I could create a PR for it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] GhostVaibhav commented on issue #362: Reduce docker image size with multi-stage build

Posted by GitBox <gi...@apache.org>.
GhostVaibhav commented on issue #362:
URL: https://github.com/apache/age/issues/362#issuecomment-1339813930

   I made some changes to the script:
   ```dockerfile
   # Build stage
   FROM postgres:11-buster AS build
   RUN apt-get update 
   RUN apt-get install --assume-yes --no-install-recommends --no-install-suggests \
     bison \
     build-essential \
     flex \
     postgresql-server-dev-11 
   COPY . /age 
   RUN cd /age && make install
   
   # Install stage
   FROM postgres:11-buster
   COPY --from=build /age/docker-entrypoint-initdb.d/00-create-extension-age.sql /docker-entrypoint-initdb.d/00-create-extension-age.sql
   COPY --from=build /usr/lib/postgresql/11/lib/age.so /usr/lib/postgresql/11/lib/age.so
   COPY --from=build /usr/share/postgresql/11/extension/age.control /usr/share/postgresql/11/extension/age.control
   CMD ["postgres", "-c", "shared_preload_libraries=age"]
   ```
   I also started working on fixing the issue but it's showing the following error when I try to execute the above Dockerfile:
   ```shell
   /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/00-create-extension-age.sql
   2022-12-06 18:16:25.044 UTC [73] ERROR:  extension "age" has no installation script nor update path for version "1.1.0"
   2022-12-06 18:16:25.044 UTC [73] STATEMENT:  CREATE EXTENSION age;
   psql:/docker-entrypoint-initdb.d/00-create-extension-age.sql:19: ERROR:  extension "age" has no installation script nor update path for version "1.1.0"
   ```
   
   FYI, I learned that you only need 2 files to install the extension in Postgres, namely `age.so` and `age.control`. But it's showing an error even after installing these files and copying the initial `00-create-extension-age.sql` file.
   On second thought, we can clean the existing image using the `apt remove` commands and delete the AGE repo folder altogether.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org