File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,13 +4,26 @@ ARG FILE_SUFFIX
44
55# Install dependencies
66RUN apt-get update
7- RUN apt-get install -y zip binutils
7+ RUN apt-get install -y zip binutils wget tar xz-utils
8+
9+ # UPX installation directly from GitHub
10+ ENV UPX_VERSION=5.0.0
11+ RUN ARCH=$(uname -m) && \
12+ if [ "$ARCH" = "x86_64" ]; then \
13+ ARCH_NAME="amd64"; \
14+ elif [ "$ARCH" = "aarch64" ]; then \
15+ ARCH_NAME="arm64"; \
16+ fi && \
17+ wget https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-${ARCH_NAME}_linux.tar.xz && \
18+ tar -xf upx-${UPX_VERSION}-${ARCH_NAME}_linux.tar.xz && \
19+ mv upx-${UPX_VERSION}-${ARCH_NAME}_linux/upx /usr/local/bin/ && \
20+ rm -rf upx-${UPX_VERSION}-${ARCH_NAME}_linux upx-${UPX_VERSION}-${ARCH_NAME}_linux.tar.xz
821
922# Copy Go Agent binary
1023COPY .binaries/datadog-agent-$FILE_SUFFIX /datadog-agent-go
1124
12- # UPX compress on x86_64
13- RUN if [ "$PLATFORM" = "x86_64" ]; then apt-get install -y upx=3.96-r0 && upx -1 /datadog-agent-go; fi
25+ # UPX compress
26+ RUN upx -1 /datadog-agent-go
1427
1528RUN mkdir /extensions
1629WORKDIR /extensions
Original file line number Diff line number Diff line change @@ -48,12 +48,6 @@ RUN /usr/lib/go/bin/go tool nm datadog-agent | grep -w 'github.com/DataDog/datad
4848# Strip the binary to reduce size
4949RUN strip datadog-agent
5050
51- # Compress the binary with UPX, but only if the architecture is x86_64
52- RUN arch="$(uname -m)"; \
53- if [ "${arch}" = 'x86_64' ]; then \
54- apk add --no-cache upx=3.96-r1 && upx -1 datadog-agent; \
55- fi;
56-
5751# Use the smallest image possible
5852FROM scratch
5953COPY --from=compiler /tmp/dd/datadog-agent/cmd/serverless/datadog-agent /
Original file line number Diff line number Diff line change @@ -50,9 +50,6 @@ RUN /usr/local/go/bin/go tool nm datadog-agent | grep -w 'github.com/DataDog/dat
5050# Strip the binary to reduce size
5151RUN strip datadog-agent
5252
53- # Compress the binary with UPX, but only if the architecture is x86_64
54- RUN if [ "$arch" = "x86_64" ]; then apt-get install -y upx=3.96-r0 && upx -1 /datadog-agent; fi
55-
5653# Use the smallest image possible
5754FROM scratch
5855COPY --from=compiler /tmp/dd/datadog-agent/cmd/serverless/datadog-agent /
You can’t perform that action at this time.
0 commit comments