-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
191 lines (162 loc) · 4.34 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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# syntax = docker/dockerfile:1.6
## build
ARG KLIPPER_REPOSITORY=https://github.com/klipper3d/klipper
ARG MOONRAKER_REPOSITORY=https://github.com/Arksine/moonraker
ARG KLIPPER_SHA
ARG MOONRAKER_SHA
FROM debian:bookworm as build
ARG KLIPPER_REPOSITORY
ARG MOONRAKER_REPOSITORY
ARG KLIPPER_SHA
ARG MOONRAKER_SHA
RUN <<eot
set -e
apt-get update -qq
apt-get install -y --no-install-recommends --no-install-suggests \
avr-libc \
cmake \
fakeroot \
g++ \
git \
help2man \
libcurl4-openssl-dev \
libffi-dev \
libldap2-dev \
libsasl2-dev \
libssl-dev \
make \
python3 \
python3-dev \
python3-virtualenv \
rst2pdf \
swig \
texinfo
rm -rf /var/lib/apt/lists/*
eot
WORKDIR /build
RUN <<eot
set -e
git clone git://git.savannah.nongnu.org/simulavr.git
(
cd simulavr
make cfgclean python build
(
cd build/pysimulavr
mkdir pysimulavr
strip *.so -o pysimulavr/_pysimulavr.so
cp pysimulavr.py pysimulavr/
)
)
eot
RUN git clone $KLIPPER_REPOSITORY klipper
COPY klipper ./klipper/
RUN <<eot
set -e
(
cd klipper
[ -n "$KLIPPER_SHA" ] && git reset --hard $KLIPPER_SHA || true
make
mv out/klipper.elf simulavr.elf
rm -rf .git lib out src
)
virtualenv klippy-env
./klippy-env/bin/pip install -r klipper/scripts/klippy-requirements.txt
./klippy-env/bin/python klipper/klippy/chelper/__init__.py
eot
RUN <<eot
set -e
git clone $MOONRAKER_REPOSITORY moonraker
(
cd moonraker
[ -n "$MOONRAKER_SHA" ] && git reset --hard $MOONRAKER_SHA || true
rm -rf .git
)
virtualenv moonraker-env
./moonraker-env/bin/pip install -r moonraker/scripts/moonraker-requirements.txt
eot
RUN <<eot
set -e
git clone --depth 1 https://github.com/jacksonliam/mjpg-streamer
(
cd mjpg-streamer
(
cd mjpg-streamer-experimental
mkdir _build
(
cd _build
cmake -DPLUGIN_INPUT_HTTP=OFF -DPLUGIN_INPUT_UVC=OFF -DPLUGIN_OUTPUT_FILE=OFF -DPLUGIN_OUTPUT_RTSP=OFF -DPLUGIN_OUTPUT_UDP=OFF ..
)
make
rm -rf _build
)
)
eot
RUN git clone --depth 1 https://github.com/pedrolamas/klipper-virtual-pins
RUN git clone --depth 1 https://github.com/th33xitus/kiauh
RUN git clone --depth 1 https://github.com/mainsail-crew/moonraker-timelapse
COPY mjpg_streamer_images ./mjpg-streamer/mjpg-streamer-experimental/images
WORKDIR /output
COPY klipper_config ./printer_data/config
RUN <<eot
set -e
(
cd printer_data
mkdir comms
mkdir database
mkdir gcodes
mkdir logs
)
mv /build/klipper .
mv /build/klippy-env .
mv /build/moonraker .
mv /build/moonraker-env .
mv /build/simulavr/build/pysimulavr/pysimulavr .
mv /build/mjpg-streamer/mjpg-streamer-experimental ./mjpg-streamer
mv /build/klipper-virtual-pins/virtual_pins.py ./klipper/klippy/extras/virtual_pins.py
mv /build/kiauh/resources/gcode_shell_command.py ./klipper/klippy/extras/gcode_shell_command.py
mv /build/kiauh/resources/shell_command.cfg ./printer_data/config/printer/shell_command.cfg
mv /build/moonraker-timelapse/component/timelapse.py ./moonraker/moonraker/components/timelapse.py
mv /build/moonraker-timelapse/klipper_macro/timelapse.cfg ./printer_data/config/printer/timelapse.cfg
./klippy-env/bin/python -m compileall klipper/klippy
./moonraker-env/bin/python -m compileall moonraker/moonraker
python3 -m compileall pysimulavr
eot
## final
FROM debian:bookworm-slim as final
ARG KLIPPER_REPOSITORY
ARG MOONRAKER_REPOSITORY
ARG KLIPPER_SHA
ARG MOONRAKER_SHA
ENV KLIPPER_REPOSITORY=$KLIPPER_REPOSITORY
ENV MOONRAKER_REPOSITORY=$MOONRAKER_REPOSITORY
ENV KLIPPER_SHA=$KLIPPER_SHA
ENV MOONRAKER_SHA=$MOONRAKER_SHA
ENV SIMULAVR_PACING_RATE=0.0
WORKDIR /printer
COPY --from=build /output .
RUN <<eot
set -e
apt-get update -qq
apt-get install -y --no-install-recommends --no-install-suggests \
ca-certificates \
curl \
iproute2 \
libjpeg-dev \
liblmdb-dev \
libopenjp2-7 \
libsodium-dev \
libssl-dev \
sudo \
supervisor \
zlib1g-dev
apt-get autoremove -y
apt-get clean -y
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
groupadd --force -g 1000 printer
useradd -rm -d /printer -g 1000 -u 1000 printer
echo 'printer ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/printer
chown -hR printer:printer .
eot
COPY ./rootfs /
USER printer
ENTRYPOINT ["/usr/bin/start"]