-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile.static-build
More file actions
35 lines (29 loc) · 1 KB
/
Copy pathDockerfile.static-build
File metadata and controls
35 lines (29 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
FROM golang:1.25-alpine
RUN apk add --no-cache \
git \
build-base \
autoconf \
automake \
libtool \
linux-headers \
alsa-lib-dev
WORKDIR /tmp
# Build ALSA library statically
RUN git clone https://github.com/alsa-project/alsa-lib.git && \
cd alsa-lib && \
git checkout v1.2.10 && \
libtoolize --force --copy --automake && \
aclocal && \
autoheader && \
automake --foreign --copy --add-missing && \
autoconf && \
./configure --prefix=/usr/local --enable-shared=no --enable-static=yes --disable-ucm && \
make -j$(nproc) && \
make install
WORKDIR /app
COPY . .
ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
ENV CGO_CFLAGS="-I/usr/local/include"
ENV CGO_LDFLAGS="-L/usr/local/lib"
RUN CGO_ENABLED=1 go build -ldflags '-linkmode external -extldflags "-static -L/usr/local/lib"' -o collidertracker-static
RUN file collidertracker-static && (ldd collidertracker-static 2>/dev/null || echo "✓ Static binary!") && ls -lh collidertracker-static