-
-
Notifications
You must be signed in to change notification settings - Fork 503
/
Dockerfile
executable file
·65 lines (49 loc) · 1.87 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
FROM node:22-bookworm AS companion-builder
RUN corepack enable
# Installation Prep
RUN apt-get update && apt-get install -y \
libusb-1.0-0-dev \
libudev-dev \
&& rm -rf /var/lib/apt/lists/*
RUN yarn config set httpTimeout 100000
WORKDIR /app
COPY . /app/
# Generate version number file
RUN yarn
RUN yarn build:writefile
# build the application
RUN ELECTRON=0 yarn dist
# make the production image
FROM debian:bookworm-slim
WORKDIR /app
COPY --from=companion-builder /app/dist /app/
COPY --from=companion-builder /app/docker-entrypoint.sh /docker-entrypoint.sh
# 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/*
# Don't run as root
RUN useradd -ms /bin/bash companion
# 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
# Once docker mounts the volume, the directory will be owned by node:node
ENV COMPANION_CONFIG_BASEDIR=/companion
RUN 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"]