forked from oskar456/rtp2httpd
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
66 lines (57 loc) · 1.7 KB
/
Dockerfile
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Build stage
FROM --platform=$BUILDPLATFORM debian:bullseye-slim AS builder
ARG TARGETPLATFORM
ARG BUILDPLATFORM
# Install build dependencies
RUN set -ex; \
apt-get update; \
apt-get install -y \
autoconf \
automake \
pkg-config; \
case "$TARGETPLATFORM" in \
"$BUILDPLATFORM") apt-get install -y build-essential ;; \
"linux/arm64") \
dpkg --add-architecture arm64 && \
apt-get install -y \
crossbuild-essential-arm64 \
gcc-aarch64-linux-gnu ;; \
"linux/arm/v7") \
dpkg --add-architecture armhf && \
apt-get install -y \
crossbuild-essential-armhf \
gcc-arm-linux-gnueabihf ;; \
"linux/amd64") \
dpkg --add-architecture amd64 && \
apt-get install -y \
crossbuild-essential-amd64 \
gcc-x86-64-linux-gnu ;; \
*) echo "Unsupported platform combination: $BUILDPLATFORM -> $TARGETPLATFORM" && exit 1 ;; \
esac && \
rm -rf /var/lib/apt/lists/*
# Copy source code
WORKDIR /workdir
COPY . .
RUN case "$TARGETPLATFORM" in \
"$BUILDPLATFORM") ARCH_FLAGS="" ;; \
"linux/amd64") ARCH_FLAGS="--host=x86_64-linux-gnu" ;; \
"linux/arm64") ARCH_FLAGS="--host=aarch64-linux-gnu" ;; \
"linux/arm/v7") ARCH_FLAGS="--host=arm-linux-gnueabihf" ;; \
esac && \
echo "Building with ARCH_FLAGS=$ARCH_FLAGS" && \
autoreconf -fi && \
./configure ${ARCH_FLAGS} && \
make
# Runtime stage
FROM debian:bullseye-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
libgcc1 \
&& rm -rf /var/lib/apt/lists/*
# Copy the built binary and config
COPY --from=builder /workdir/src/rtp2httpd /usr/local/bin/
COPY --from=builder /workdir/rtp2httpd.conf /usr/local/etc/
# Expose the default port
EXPOSE 8080
# Run the application
ENTRYPOINT ["/usr/local/bin/rtp2httpd"]