Giter VIP home page Giter VIP logo

Comments (11)

ruslantalpa avatar ruslantalpa commented on May 26, 2024

I think this is worth investigating more
You might get away with adding this as runtime dependency http://pkgs.alpinelinux.org/package/v3.4/main/armhf/libgcc and not the whole gcc

after this change, the image is 165M size and that defeats the purpose of using alpine as base
openresty/openresty alpine 3b4c539c6ec2 32 hours ago 165.6 MB

looking into it, i'll post back if this works

from docker-openresty.

neomantra avatar neomantra commented on May 26, 2024

I am actually in progress with exactly that (using libgcc), after thinking about our other issue/conversation ;)

from docker-openresty.

neomantra avatar neomantra commented on May 26, 2024

If you are interested in following along:

diff --git a/alpine/Dockerfile b/alpine/Dockerfile
index 2a110b0..1036f52 100644
--- a/alpine/Dockerfile
+++ b/alpine/Dockerfile
@@ -55,21 +55,21 @@ RUN \
     apk add --no-cache --virtual .build-deps \
         build-base \
         curl \
+        gcc \
         gd-dev \
         geoip-dev \
         libxslt-dev \
         linux-headers \
         make \
         perl-dev \
+        readline \
         zlib-dev \
     && apk add --no-cache \
-        gcc \
         gd \
         geoip \
+        libgcc \
         libxslt \
         ncurses \
-        perl \
-        readline \
         zlib \
     && cd /tmp \
     && curl -fSL https://www.openssl.org/source/openssl-${RESTY_OPENSSL_VERSION}.tar.gz -o openssl-${RESTY_OPENSSL_VERSION}.tar.gz \

from docker-openresty.

ruslantalpa avatar ruslantalpa commented on May 26, 2024

I can confirm using libgcc instead of gcc works.
I checked it like this:

  1. compiled with libgcc instead of gcc
  2. checked the image size (87M)
  3. inside the container i executed
    /usr/local/openresty/bin/resty -e "ngx.say('hello')" and it worked
  4. removed the lib like this mv /usr/lib/libgcc_s.so.1 /usr/lib/libgcc_s.so.1.temp and checked step 3 again, and it generated the reported error

long story short, change this line https://github.com/openresty/docker-openresty/blob/master/alpine/Dockerfile#L66

from gcc \ to libgcc \

PS: it's worth investigating a bit where these 87M come from
alpine is about 5M
/usr/local/openresty after the build is 32.4M

so there are an additional ~40M that might not be really needed

from docker-openresty.

ruslantalpa avatar ruslantalpa commented on May 26, 2024

you don't need gcc in .build-deps, it compiles without it

from docker-openresty.

ruslantalpa avatar ruslantalpa commented on May 26, 2024

curious as to why you chose to add --with-http_perl_module=dynamic since the point of openresty is to use lua. Will anybody be using perl with this image?

from docker-openresty.

ruslantalpa avatar ruslantalpa commented on May 26, 2024

removing perl get's us to
openresty latest f2e26742a6bb 37 seconds ago 45.96 MB

It's worth looking at this image https://github.com/ficusio/openresty/blob/master/alpine/Dockerfile since it's size 13M and see why this official image is so big

from docker-openresty.

neomantra avatar neomantra commented on May 26, 2024

So you are right on a few fronts...

  • libgcc can be used instead of gcc as a runtime depend
  • gcc is included in build-base so adding it is redundant
  • why include the perl module (I was following an amalgamation of various nginx guides)

I'll wait a bit to see if you have more comments, but otherwise I'll commit these changes.

Thanks for looking into this.

from docker-openresty.

ruslantalpa avatar ruslantalpa commented on May 26, 2024

looks like the docs are a bit old, downloading that image shows this
ficusio/openresty latest 849eac5fefd4 4 months ago 35.03 MB

from docker-openresty.

ruslantalpa avatar ruslantalpa commented on May 26, 2024

I have not discovered any other 'pearls' so i guess you should commit this and get the image to 80M.
The next step would be to decide on perl/resty issue.

PS: I realise that i't mostly "a thing in my head" but it bugs me a bit that the OS is 5M and this image is 80M :). For now, 80M is good enough for me to go on with my project and if along the way i find some other optimisations, i'll post back.

Thank you

from docker-openresty.

neomantra avatar neomantra commented on May 26, 2024

I just pushed that gcc changeset and it should be on Docker Hub in a bit.

from docker-openresty.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.