Skip to content

Commit 361387f

Browse files
committed
feat: switch Docker base image from Debian to Alpine for smaller image size
1 parent f7afe35 commit 361387f

File tree

1 file changed

+18
-25
lines changed

1 file changed

+18
-25
lines changed

Dockerfile

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
11
# Build stage
2-
FROM --platform=$BUILDPLATFORM debian:bullseye-slim AS builder
2+
FROM --platform=$BUILDPLATFORM alpine:3 AS builder
33

44
ARG TARGETPLATFORM
55
ARG BUILDPLATFORM
66
ARG RELEASE_VERSION
77

88
# Install build dependencies
99
RUN set -ex; \
10-
apt-get update; \
11-
apt-get install -y \
10+
apk add --no-cache \
1211
autoconf \
1312
automake \
14-
pkg-config; \
13+
pkgconfig \
14+
make \
15+
libc-dev \
16+
linux-headers; \
1517
case "$TARGETPLATFORM" in \
16-
"$BUILDPLATFORM") apt-get install -y build-essential ;; \
18+
"$BUILDPLATFORM") apk add --no-cache gcc ;; \
1719
"linux/arm64") \
18-
dpkg --add-architecture arm64 && \
19-
apt-get install -y \
20-
crossbuild-essential-arm64 \
21-
gcc-aarch64-linux-gnu ;; \
20+
apk add --no-cache \
21+
gcc-aarch64-none-elf \
22+
binutils-aarch64-none-elf || \
23+
apk add --no-cache gcc ;; \
2224
"linux/arm/v7") \
23-
dpkg --add-architecture armhf && \
24-
apt-get install -y \
25-
crossbuild-essential-armhf \
26-
gcc-arm-linux-gnueabihf ;; \
25+
apk add --no-cache \
26+
gcc-arm-none-eabi \
27+
binutils-arm-none-eabi || \
28+
apk add --no-cache gcc ;; \
2729
"linux/amd64") \
28-
dpkg --add-architecture amd64 && \
29-
apt-get install -y \
30-
crossbuild-essential-amd64 \
31-
gcc-x86-64-linux-gnu ;; \
30+
apk add --no-cache gcc ;; \
3231
*) echo "Unsupported platform combination: $BUILDPLATFORM -> $TARGETPLATFORM" && exit 1 ;; \
33-
esac && \
34-
rm -rf /var/lib/apt/lists/*
32+
esac
3533

3634
# Copy source code
3735
WORKDIR /workdir
@@ -50,12 +48,7 @@ RUN case "$TARGETPLATFORM" in \
5048
make
5149

5250
# Runtime stage
53-
FROM debian:bullseye-slim
54-
55-
# Install runtime dependencies
56-
RUN apt-get update && apt-get install -y \
57-
libgcc1 curl \
58-
&& rm -rf /var/lib/apt/lists/*
51+
FROM alpine:3
5952

6053
# Copy the built binary and config
6154
COPY --from=builder /workdir/src/rtp2httpd /usr/local/bin/

0 commit comments

Comments
 (0)