-
Notifications
You must be signed in to change notification settings - Fork 292
Expand file tree
/
Copy pathDockerfile.fly-managed
More file actions
48 lines (39 loc) · 1.34 KB
/
Dockerfile.fly-managed
File metadata and controls
48 lines (39 loc) · 1.34 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
# Fly managed runtime image for Companion instances.
#
# Build modes:
# - COMPANION_SOURCE=local: install the-companion from this repo's ./web
# - COMPANION_SOURCE=npm: install the-companion from npm registry
ARG BASE_IMAGE=docker.io/stangirard/the-companion:latest
FROM ${BASE_IMAGE}
ARG COMPANION_SOURCE=local
ARG COMPANION_NPM_VERSION=latest
WORKDIR /tmp/the-companion-src
COPY web ./web
RUN set -eux; \
if [ "$COMPANION_SOURCE" = "npm" ]; then \
npm install -g "the-companion@${COMPANION_NPM_VERSION}"; \
else \
cd web; \
bun install; \
bun run build; \
bun install -g .; \
fi
# Create a dedicated runtime user for Companion. Keep root as the container
# user so entrypoint can fix /data ownership on mounted volumes before dropping
# privileges.
RUN set -eux; \
if ! id -u companion >/dev/null 2>&1; then \
useradd -m -u 10001 -s /bin/bash companion; \
fi; \
chmod 0755 /root; \
chmod -R a+rX /root/.nvm /root/.bun; \
mkdir -p /home/companion; \
chown -R companion:companion /home/companion
ENV NODE_ENV=production
ENV PORT=3456
ENV COMPANION_RUN_AS_USER=companion
ENV PATH=/root/.nvm/default-bin:/root/.bun/bin:${PATH}
EXPOSE 3456
COPY platform/docker/entrypoint-server.sh /usr/local/bin/entrypoint-server.sh
RUN chmod +x /usr/local/bin/entrypoint-server.sh
ENTRYPOINT ["/usr/local/bin/entrypoint-server.sh"]