-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.multistage
45 lines (35 loc) · 1.03 KB
/
Dockerfile.multistage
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
# Stage 1: Build dependencies and environment setup
FROM ubuntu:22.04 AS build
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /src
# Install required packages for building
RUN apt-get update && apt-get install -y \
git \
build-essential \
libssl-dev \
uuid-dev \
cmake \
libasound2-dev \
pkg-config \
nlohmann-json3-dev \
&& rm -rf /var/lib/apt/lists/*
# Clone or copy the source code
COPY . /src
# Build the project
RUN git clone https://github.com/pjsip/pjproject.git
WORKDIR /src/pjproject
RUN ./configure
WORKDIR /src
RUN ./build.sh
# Stage 2: Runtime image with only the necessary files
FROM ubuntu:22.04 AS runtime
# Install runtime dependencies (if needed, like libraries or tools for running the application)
RUN apt-get update && apt-get install -y \
libssl-dev \
libasound2-dev \
nlohmann-json3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy the built application from the build stage
COPY --from=build /src/build/srs /usr/local/bin/srs
# Set the default command
CMD ["/usr/local/bin/srs"]