threerings / openvpn-auth-ldap

Implements username/password authentication via LDAP for OpenVPN 2.x.
Other
135 stars 62 forks source link

option to build statically #76

Open test-account-0 opened 4 years ago

test-account-0 commented 4 years ago

this is very low priority feature request

now I'm building openvpn-auth-ldap with some tricks

FROM alpine as base
RUN apk add --no-cache openvpn openssl iptables bash

FROM base as build
RUN apk add --no-cache openvpn-dev autoconf re2c libtool \
                openldap-dev libressl-dev gcc-objc make git
RUN git clone https://github.com/OpenVPN/easy-rsa.git && \
        mv /easy-rsa/easyrsa3 /usr/share/easy-rsa
RUN git clone https://github.com/threerings/openvpn-auth-ldap
RUN cd /openvpn-auth-ldap && \
        ./regen.sh && \
        ./configure --with-openvpn=/usr/include/openvpn CFLAGS="-fPIC" OBJCFLAGS="-std=gnu11" && \
        make && \
        make install
RUN cd /tmp && \
        ldd /usr/local/lib/openvpn-auth-ldap.so | tr -s '[:blank:]' '\n' | grep '^/' | \
    xargs -I % sh -c 'mkdir -p $(dirname deps%); cp % deps%;'

FROM base as production
USER root
COPY --from=build /usr/local/lib/openvpn-auth-ldap.so /usr/local/lib/
COPY --from=build /usr/share/easy-rsa/ /usr/share/easy-rsa/
COPY --from=build /tmp/deps /

RUN mkdir -p /dev/net && \
        mknod /dev/net/tun c 10 200

would it be possible to build it statically?

I tried something like this as a result of some googling, but it resulted in error

make SHARED=0 CC='gcc -static' PLUGIN_LD='gcc -static'