-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.ubuntu-22.04
86 lines (66 loc) · 3.58 KB
/
Dockerfile.ubuntu-22.04
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
# syntax=docker/dockerfile:1.5
# vim:ft=dockerfile
# Dockerfile for building mesycontrol_server and the full client package.
# Image creation:
# docker build -f ./Dockerfile.ubuntu-22.04 -t mesycontrol:latest .
# Running the server:
# docker run --rm -t --network=host --device /dev/ttyUSB0 mesycontrol:latest --mrc-serial-port /dev/ttyUSB0
# Running the gui from within the container:
# xhost +
# docker run --rm -t --network=host --device /dev/ttyUSB0 -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:rw --ipc=host --entrypoint mesycontrol_gui mesycontrol:latest
# Using the script runner to start the autopoller script:
# docker run --rm -t --network=host --device /dev/ttyUSB0 --entrypoint mesycontrol_script_runner mesycontrol:latest /dev/ttyUSB0 /mesycontrol/share/scripts/auto_poll_parameters.py
# Viewing the python scripting documentation:
# docker run --rm -it --entrypoint python mesycontrol:latest -c 'import mesycontrol.script, pydoc; help(mesycontrol.script)'
# Starting a shell to explore the container:
# docker run --rm -it --network=host --entrypoint bash mesycontrol:latest
# ls -l /mesycontrol
FROM ubuntu:22.04 as build
ENV DEBIAN_FRONTEND="noninteractive"
ENV TZ="Etc/UTC"
#ENV QT_DEBUG_PLUGINS=1 # Set to 1 for extra info to debug Qt plugin loading and find possible missing libraries.
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates build-essential git cmake python3-venv \
libboost-all-dev libprotobuf-dev protobuf-compiler \
libglib2.0-0 libgl1 libqt5widgets5
COPY . /mesycontrol-source
WORKDIR /mesycontrol-build
# venv creation and activation
RUN python3 -m venv /mesycontrol-venv
ENV PATH="/mesycontrol-venv/bin:$PATH"
RUN --mount=type=cache,target=/root/.cache python3 -m pip install --upgrade pip
# Use pip to install the build dependencies.
RUN --mount=type=cache,target=/root/.cache pip3 install pyinstaller sphinx
# Configure using cmake. This generates the mc_version.py file!
RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/mesycontrol \
-DMESYCONTROL_BUILD_CLIENT=ON -DMESYCONTROL_BUILD_DOCS=ON /mesycontrol-source
# Install the python client package which needs mc_version.py
RUN --mount=type=cache,target=/root/.cache pip3 install /mesycontrol-source/src/client
# Build the server and a frozen client package.
RUN cmake --build . -j && cmake --install .
FROM ubuntu:22.04 as final
ENV DEBIAN_FRONTEND="noninteractive"
ENV TZ="Etc/UTC"
#ENV QT_DEBUG_PLUGINS=1 # Set to 1 for extra info to debug Qt plugin loading and find possible missing libraries.
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-venv git libglib2.0-0 libgl1 libqt5widgets5 libprotobuf23
COPY --from=build /mesycontrol-source /mesycontrol-source
COPY --from=build /mesycontrol /mesycontrol
# venv creation and activation
RUN python3 -m venv /mesycontrol-venv
ENV PATH="/mesycontrol-venv/bin:$PATH"
# install the client package
RUN --mount=type=cache,target=/root/.cache python3 -m pip install --upgrade pip
RUN --mount=type=cache,target=/root/.cache pip3 install /mesycontrol-source/src/client
# cleanup
RUN apt-get clean && rm -rf /mesycontrol-source
# Some basic tests: try to start the server, import the python package, etc.
ENV PATH="/mesycontrol/bin:$PATH"
RUN mesycontrol_server --help
RUN python3 -c 'import mesycontrol'
RUN python3 -c 'from mesycontrol.script import script_runner_main; script_runner_main()'
RUN mesycontrol_script_runner
RUN test -e /mesycontrol/share/doc/mesycontrol/html/index.html
# Default entrypoint is the server binary.
WORKDIR /mesycontrol
ENTRYPOINT ["/mesycontrol/bin/mesycontrol_server"]