-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (39 loc) · 1.45 KB
/
Dockerfile
File metadata and controls
49 lines (39 loc) · 1.45 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FROM ruby:3.3-slim
# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
git \
libssl-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy gemfiles first for better caching
COPY Gemfile Gemfile.lock* webrtc-ruby.gemspec ./
COPY lib/webrtc/version.rb ./lib/webrtc/
# Install Ruby dependencies
RUN bundle install
# Clone and build libdatachannel
RUN git clone --depth 1 --recurse-submodules https://github.com/paullouisageneau/libdatachannel.git /tmp/libdatachannel \
&& cd /tmp/libdatachannel \
&& mkdir build && cd build \
&& cmake -DUSE_GNUTLS=0 -DUSE_NICE=0 -DNO_WEBSOCKET=1 -DNO_EXAMPLES=1 -DNO_TESTS=1 -DCMAKE_BUILD_TYPE=Release .. \
&& make -j$(nproc) \
&& mkdir -p /app/vendor/libdatachannel/build \
&& mkdir -p /app/vendor/libdatachannel/include \
&& cp -r /tmp/libdatachannel/include/* /app/vendor/libdatachannel/include/ \
&& cp /tmp/libdatachannel/build/libdatachannel.so* /app/vendor/libdatachannel/build/ \
&& rm -rf /tmp/libdatachannel
# Copy extension source
COPY ext/ ./ext/
# Build webrtc_ruby extension
RUN cd ext/webrtc_ruby \
&& mkdir -p build && cd build \
&& cmake .. \
&& make -j$(nproc)
# Copy the rest of the application
COPY . .
# Set library path
ENV LD_LIBRARY_PATH=/app/ext/webrtc_ruby/build:/app/vendor/libdatachannel/build
# Run tests by default
CMD ["bundle", "exec", "rspec", "--format", "documentation"]