Skip to content

Commit bd025c7

Browse files
committed
Implement partial static linking for GoAccess, keeping OpenSSL dynamic.
- Statically link non-OpenSSL dependencies (libmaxminddb, libncursesw, libintl, libc) using LDFLAGS="-static-libgcc" and musl-dev. - Keep OpenSSL dynamically linked to avoid building from source, ensuring SSL_CIPHER_standard_name() support.
1 parent 4400e58 commit bd025c7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,22 @@ RUN apk add --no-cache \
1111
linux-headers \
1212
ncurses-dev \
1313
pkgconf \
14+
musl-dev \
1415
tzdata
1516

1617
# GoAccess
1718
COPY . /goaccess
1819
WORKDIR /goaccess
1920
RUN autoreconf -fiv && rm -rf autom4te.cache
20-
RUN CC="clang" CFLAGS="-O3" LIBS="$(pkg-config --libs openssl)" ./configure --prefix=/usr --enable-utf8 --with-openssl --enable-geoip=mmdb
21+
# Configure with partial static linking (OpenSSL dynamic)
22+
RUN CC="clang" CFLAGS="-O3" LDFLAGS="-static-libgcc" LIBS="$(pkg-config --libs openssl)" ./configure --prefix=/usr --enable-utf8 --with-openssl --enable-geoip=mmdb
2123
RUN make -j$(nproc) && make DESTDIR=/dist install
22-
# Check dynamic dependencies
24+
# Check dynamic dependencies (expect only libssl.so, libcrypto.so, ld-musl)
2325
RUN ldd /dist/usr/bin/goaccess && echo "Dependencies checked"
2426

2527
# Runtime stage
2628
FROM alpine:3.20
2729
RUN apk add --no-cache \
28-
gettext-libs \
29-
libmaxminddb \
30-
ncurses-libs \
3130
openssl \
3231
tzdata
3332
# Create non-root user

0 commit comments

Comments
 (0)