-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathDockerfile
More file actions
69 lines (52 loc) · 1.61 KB
/
Dockerfile
File metadata and controls
69 lines (52 loc) · 1.61 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
66
67
68
69
FROM node:22-bookworm-slim AS build
WORKDIR /bonob
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get -y upgrade && \
apt-get -y install --no-install-recommends \
libvips-dev \
python3 \
make \
git \
g++ && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install dependencies first so this layer caches when only source changes
COPY package.json package-lock.json .npmrc ./
RUN npm ci
# Now copy source and build
COPY tsconfig.json jest.config.js register.js ./
COPY src ./src
COPY typings ./typings
COPY .git ./.git
RUN npm run gitinfo && \
npm run build && \
npm prune --omit=dev
FROM node:22-bookworm-slim
LABEL maintainer="simojenki" \
org.opencontainers.image.source="https://github.com/simojenki/bonob" \
org.opencontainers.image.description="bonob SONOS SMAPI implementation" \
org.opencontainers.image.licenses="GPLv3"
ENV BNB_PORT=4534
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
EXPOSE $BNB_PORT
WORKDIR /bonob
RUN apt-get update && \
apt-get -y upgrade && \
apt-get -y install --no-install-recommends \
libvips \
tzdata \
wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY package.json package-lock.json ./
COPY --from=build /bonob/build/src ./src
COPY --from=build /bonob/node_modules ./node_modules
COPY --from=build /bonob/.gitinfo ./
COPY web ./web
COPY src/Sonoswsdl-1.19.6-20231024.wsdl ./src/Sonoswsdl-1.19.6-20231024.wsdl
USER nobody
WORKDIR /bonob/src
HEALTHCHECK CMD wget -O- http://localhost:${BNB_PORT}/about || exit 1
CMD ["node", "app.js"]