-
-
Notifications
You must be signed in to change notification settings - Fork 503
/
Dockerfile.prebuild
executable file
·54 lines (43 loc) · 1.96 KB
/
Dockerfile.prebuild
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
FROM debian:bookworm-slim
ARG build_name
ARG TARGETPLATFORM
# Install curl for the health check
RUN apt update && apt install -y \
procps \
curl \
libusb-1.0-0 \
libudev1 \
iputils-ping \
libasound2 \
libfontconfig1 \
&& rm -rf /var/lib/apt/lists/*
RUN case ${TARGETPLATFORM} in \
"linux/amd64") ARCH=x64 ;; \
"linux/arm64") ARCH=arm64 ;; \
*) echo "Unsupported platform ${TARGETPLATFORM}"; exit 9 ;; \
esac \
&& curl https://s3.bitfocus.io/builds/companion/companion-linux-${ARCH}-${build_name}.tar.gz --output /tmp/companion-build.tar.gz \
&& mkdir /tmp/companion \
&& tar -xzf /tmp/companion-build.tar.gz --strip-components=1 -C /tmp/companion \
&& mv /tmp/companion/resources /app \
&& rm -R /tmp/companion-build.tar.gz /tmp/companion
COPY docker-entrypoint.sh /docker-entrypoint.sh
WORKDIR /app
# setup path and corepack
ENV PATH="$PATH:/app/node-runtimes/main/bin"
RUN echo "PATH="${PATH}"" | tee -a /etc/environment
RUN corepack enable
# Create config directory and set correct permissions to not run as root
# Once docker mounts the volume, the directory will be owned by companion:companion
ENV COMPANION_CONFIG_BASEDIR=/companion
RUN useradd -ms /bin/bash companion \
&& mkdir $COMPANION_CONFIG_BASEDIR && chown companion:companion $COMPANION_CONFIG_BASEDIR
USER companion
# Export ports for web, Satellite API and WebSocket (Elgato Plugin)
EXPOSE 8000 16622 16623 28492
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 CMD [ "curl", "-fSsq", "http://localhost:8000/" ]
# module-local-dev dependencies
# Dependencies will be installed and cached once the container is started
ENTRYPOINT [ "/docker-entrypoint.sh" ]
# Bind to 0.0.0.0, as access should be scoped down by how the port is exposed from docker
CMD ["sh", "-c", "./node-runtimes/main/bin/node ./main.js --admin-address 0.0.0.0 --admin-port 8000 --config-dir $COMPANION_CONFIG_BASEDIR --extra-module-path /app/module-local-dev"]