Closed Nordes closed 3 years ago
Well you need to know which package provides the error.h
header file. Usually it's included into libc6-dev
but looks like this distro doesn't contain it.
In the end, I used a nginx image based on buster and the result look like this:
FROM debian:buster-slim as Base # Store this as a base image so we don't need to do this anymore
WORKDIR /build
# Missing clean-up, but it's ok (it's a build after all)
RUN apt update && apt install wget build-essential cmake sudo libjsoncpp-dev -y && \
wget -qO- http://bit.ly/ngrest | bash
FROM Base as Build
WORKDIR /build
COPY [".", "."]
RUN chmod +x build.sh && ./build.sh # Build.sh contains the stuff to build the whole thing (see later below)
#=====================================
# this nginx is a buster based image
FROM nginx:1.19.8 as final
WORKDIR /app
RUN apt update && apt install libjsoncpp-dev -y && ln -s /usr/include/jsoncpp/json/ /usr/include/json
# Add the lib
COPY --from=Build ["/build/publish", "."]
COPY --from=Build ["/build/build-assets/mod_ngrest.so", "/etc/nginx/modules/mod_ngrest.so"]
COPY --from=Build ["/build/lib/", "/lib/x86_64-linux-gnu/"]
RUN chmod 655 /etc/nginx/modules/mod_ngrest.so
COPY --from=Build ["/build/build-assets/nginx/", "/etc/nginx/"]
RUN mkdir -p /app/logs && chmod 0777 /app/logs
expose 80
STOPSIGNAL SIGTERM
CMD ["nginx", "-g", "daemon **off;"]**
The build.sh is like this:
❯ cat build.sh
#!/bin/bash
# Cleanup
rm -f ngrest-server-bundle.tar.xz && rm -f mystuff-ngrest.tar.xz
# Cp libs
cp -R ./lib/libfwlib32* /lib/x86_64-linux-gnu/
ln -s /usr/include/jsoncpp/json/ /usr/include/json
# Bundle the server part (mandatory)
# http://localhost:1984/ngrest/services
ngrest bundle-server
mv ngrest-server-bundle*.tar.xz ngrest-server-bundle.tar.xz
# Bundle mystuff API
mkdir -p publish
ngrest build && ngrest bundle && mv mystuff-ngrest*.tar.xz mystuff-ngrest.tar.xz
# Prepare published folder.
mkdir -p publish
mv *.tar.xz publish
cd publish
tar -xf ngrest-server-bundle.tar.xz
rm -f ngrest-server-bundle.tar.xz
mv mystuff-ngrest.tar.xz ngrest
cd ngrest
tar -xf mystuff-ngrest.tar.xz
rm -f mystuff-ngrest.tar.xz
rm -f **/build/publish/ngrest/share/ngrest/services/favicon.so**
Hi there,
Thanks for all your work. It's very a nice project that you've got there.
I was wondering if it was possible to compile from within an Alpine image? I am asking this question because I want to build the NGINX module and then copy it (the .so) to nginx residing in my final docker image.
So far, I did the following:
This fails at some point:
Can you help me with this?
For now, I will go back to a more traditional ubuntu based image, but it would be very nice to make it work on alpine based image.