-
Notifications
You must be signed in to change notification settings - Fork 974
Expand file tree
/
Copy pathDockerfile
More file actions
107 lines (92 loc) · 3.98 KB
/
Dockerfile
File metadata and controls
107 lines (92 loc) · 3.98 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
FROM python:3.12-slim
RUN apt-get update && apt-get install -y \
git \
ffmpeg \
portaudio19-dev \
libasound2-dev \
libv4l-dev \
python3-pip \
build-essential \
cmake \
python3-dev \
libasound2 \
libasound2-data \
libasound2-plugins \
libpulse0 \
alsa-utils \
alsa-topology-conf \
alsa-ucm-conf \
pulseaudio-utils \
iputils-ping \
curl \
pkg-config \
libssl-dev \
libnss-mdns \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN python3 -m pip install --upgrade pip
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN mkdir -p /etc/alsa && \
ln -snf /usr/share/alsa/alsa.conf.d /etc/alsa/conf.d
RUN printf '%s\n' \
'pcm.!default { type pulse }' \
'ctl.!default { type pulse }' \
> /etc/asound.conf
RUN if ! grep -q 'mdns4_minimal' /etc/nsswitch.conf; then \
sed -i 's/^\(hosts:[[:space:]]*files\)\(.*\)$/\1 mdns4_minimal [NOTFOUND=return]\2/' /etc/nsswitch.conf; \
fi
WORKDIR /app
RUN git clone --branch releases/0.10.x https://github.com/eclipse-cyclonedds/cyclonedds
WORKDIR /app/cyclonedds/build
RUN cmake .. -DCMAKE_INSTALL_PREFIX=../install -DBUILD_EXAMPLES=ON \
&& cmake --build . --target install
ENV CYCLONEDDS_HOME=/app/cyclonedds/install \
CMAKE_PREFIX_PATH=/app/cyclonedds/install
WORKDIR /app/OM1
COPY . .
RUN git submodule update --init --recursive
RUN cp -r config config_defaults
RUN uv venv /app/OM1/.venv && \
uv pip install -r pyproject.toml --extra dds
ENV VIRTUAL_ENV=/app/OM1/.venv
ENV PATH="/app/OM1/.venv/bin:$PATH"
RUN echo '#!/bin/bash' > /entrypoint.sh && \
echo 'set -e' >> /entrypoint.sh && \
echo 'cp -r /app/OM1/config_defaults/* /app/OM1/config/ 2>/dev/null || true' >> /entrypoint.sh && \
echo 'if [ "${OM1_SKIP_INTERNET_CHECK}" = "true" ]; then' >> /entrypoint.sh && \
echo ' echo "Skipping internet connectivity check."' >> /entrypoint.sh && \
echo 'else' >> /entrypoint.sh && \
echo ' until ping -c1 -W1 8.8.8.8 >/dev/null 2>&1; do' >> /entrypoint.sh && \
echo ' echo "Waiting for internet connection..."' >> /entrypoint.sh && \
echo ' sleep 2' >> /entrypoint.sh && \
echo ' done' >> /entrypoint.sh && \
echo ' echo "Internet connected."' >> /entrypoint.sh && \
echo 'fi' >> /entrypoint.sh && \
echo 'echo "Checking audio system..."' >> /entrypoint.sh && \
echo 'if ! pactl info >/dev/null 2>&1; then' >> /entrypoint.sh && \
echo ' echo "ERROR: PulseAudio connection failed. Exiting container for restart..."' >> /entrypoint.sh && \
echo ' exit 1' >> /entrypoint.sh && \
echo 'fi' >> /entrypoint.sh && \
echo 'echo "PulseAudio connected successfully."' >> /entrypoint.sh && \
echo 'if ! pactl list sinks | grep -q "default_output_aec" 2>/dev/null; then' >> /entrypoint.sh && \
echo ' echo "ERROR: Audio device default_output_aec not found. Exiting container for restart..."' >> /entrypoint.sh && \
echo ' echo "Available audio sinks:"' >> /entrypoint.sh && \
echo ' pactl list short sinks 2>/dev/null || echo "No sinks available"' >> /entrypoint.sh && \
echo ' exit 1' >> /entrypoint.sh && \
echo 'fi' >> /entrypoint.sh && \
echo 'echo "Audio device default_output_aec is ready."' >> /entrypoint.sh && \
echo 'echo "Starting main command..."' >> /entrypoint.sh && \
echo 'if [ -n "${OM1_COMMAND}" ]; then' >> /entrypoint.sh && \
echo ' exec python src/run.py "${OM1_COMMAND}"' >> /entrypoint.sh && \
echo 'elif [ -f "/app/OM1/config/memory/.runtime.json5" ]; then' >> /entrypoint.sh && \
echo ' exec python src/run.py' >> /entrypoint.sh && \
echo 'else' >> /entrypoint.sh && \
echo ' exec python src/run.py "$@"' >> /entrypoint.sh && \
echo 'fi' >> /entrypoint.sh && \
chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["spot"]