forked from OctoPrint/octoprint-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
91 lines (76 loc) · 2.19 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
ARG PYTHON_BASE_IMAGE=3.10-slim-bullseye
FROM ubuntu AS s6build
ARG S6_RELEASE
ENV S6_VERSION ${S6_RELEASE:-v2.1.0.0}
RUN apt-get update && apt-get install -y curl
RUN echo "$(dpkg --print-architecture)"
WORKDIR /tmp
RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
&& case "${dpkgArch##*-}" in \
amd64) ARCH='amd64';; \
arm64) ARCH='aarch64';; \
armhf) ARCH='armhf';; \
*) echo "unsupported architecture: $(dpkg --print-architecture)"; exit 1 ;; \
esac \
&& set -ex \
&& echo $S6_VERSION \
&& curl -fsSLO "https://github.com/just-containers/s6-overlay/releases/download/$S6_VERSION/s6-overlay-$ARCH.tar.gz"
FROM python:${PYTHON_BASE_IMAGE} AS build
ARG octoprint_ref
ENV octoprint_ref ${octoprint_ref:-master}
RUN apt-get update && apt-get install -y \
avrdude \
build-essential \
cmake \
curl \
imagemagick \
ffmpeg \
fontconfig \
g++ \
git \
haproxy \
libffi-dev \
libjpeg-dev \
libjpeg62-turbo \
libprotobuf-dev \
libudev-dev \
libusb-1.0-0-dev \
libv4l-dev \
openssh-client \
v4l-utils \
xz-utils \
zlib1g-dev \
x265
# unpack s6
COPY --from=s6build /tmp /tmp
RUN s6tar=$(find /tmp -name "s6-overlay-*.tar.gz") \
&& tar xzf $s6tar -C /
# Install octoprint
RUN curl -fsSLO --compressed --retry 3 --retry-delay 10 \
https://github.com/OctoPrint/OctoPrint/archive/${octoprint_ref}.tar.gz \
&& mkdir -p /opt/octoprint \
&& tar xzf ${octoprint_ref}.tar.gz --strip-components 1 -C /opt/octoprint --no-same-owner
WORKDIR /opt/octoprint
RUN pip install .
RUN mkdir -p /octoprint/octoprint /octoprint/plugins
# Install mjpg-streamer
RUN curl -fsSLO --compressed --retry 3 --retry-delay 10 \
https://github.com/jacksonliam/mjpg-streamer/archive/master.tar.gz \
&& mkdir /mjpg \
&& tar xzf master.tar.gz -C /mjpg
WORKDIR /mjpg/mjpg-streamer-master/mjpg-streamer-experimental
RUN make
RUN make install
# Copy services into s6 servicedir and set default ENV vars
COPY root /
ENV CAMERA_DEV /dev/video0
ENV MJPG_STREAMER_INPUT -n -r 640x480
ENV PIP_USER true
ENV PYTHONUSERBASE /octoprint/plugins
ENV PATH "${PYTHONUSERBASE}/bin:${PATH}"
# set WORKDIR
WORKDIR /octoprint
# port to access haproxy frontend
EXPOSE 80
VOLUME /octoprint
ENTRYPOINT ["/init"]