-
-
Notifications
You must be signed in to change notification settings - Fork 586
Expand file tree
/
Copy pathDockerfile.prebuild
More file actions
executable file
·65 lines (53 loc) · 2.19 KB
/
Copy pathDockerfile.prebuild
File metadata and controls
executable file
·65 lines (53 loc) · 2.19 KB
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:26-trixie AS corepack-setup
# This is a bit of a hack, but we need corepack from somewhere, and dont' have npm inside the shipped binaries
RUN npm install -g corepack && corepack enable && \
tar -czf /tmp/corepack.tar.gz \
-C / usr/local/lib/node_modules/corepack \
usr/local/bin/corepack usr/local/bin/yarn usr/local/bin/yarnpkg
FROM debian:trixie-slim
ARG linux_x64_url
ARG linux_arm64_url
ARG TARGETPLATFORM
# Install curl for the health check
RUN apt update && apt install -y \
procps \
curl \
jq \
libusb-1.0-0 \
libudev1 \
iputils-ping \
libasound2 \
libfontconfig1 \
libatomic1 \
&& rm -rf /var/lib/apt/lists/*
RUN case ${TARGETPLATFORM} in \
"linux/amd64") URL=${linux_x64_url} ;; \
"linux/arm64") URL=${linux_arm64_url} ;; \
*) echo "Unsupported platform ${TARGETPLATFORM}"; exit 9 ;; \
esac \
&& curl ${URL} --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 --mount=type=bind,from=corepack-setup,source=/tmp/corepack.tar.gz,target=/tmp/corepack.tar.gz \
tar -xzf /tmp/corepack.tar.gz -C /
# 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
ENV COMPANION_ADMIN_PORT=8000
USER companion
# Export ports for web and Satellite API (TCP + WS)
EXPOSE 8000 16622 16623
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD [ "sh", "-c", "curl -fSsq http://localhost:${COMPANION_ADMIN_PORT:-8000}/" ]
# module-local-dev dependencies
# Dependencies will be installed and cached once the container is started
ENTRYPOINT [ "/docker-entrypoint.sh" ]