-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile
45 lines (36 loc) · 961 Bytes
/
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
# ha base image
ARG BUILD_FROM
# first stage, can't use alpine for building armv7
FROM node:22 AS builder
WORKDIR /app
### remote
# clone, build and remove repo example data
RUN git clone --depth 1 https://github.com/matt8707/ha-fusion . && \
npm install --verbose && \
npm run build && \
npm prune --omit=dev && \
rm -rf ./data/*
# ### local
# COPY rootfs .
# RUN npm install --verbose && \
# npm run build && \
# npm prune --omit=dev
# second stage
FROM $BUILD_FROM
WORKDIR /rootfs
# copy files to /rootfs
COPY --from=builder /app/build ./build
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/server.js .
COPY --from=builder /app/package.json .
# copy run
COPY run.sh /
# install node, symlink persistent data and chmod run
RUN apk add --no-cache nodejs-current && \
ln -s /rootfs/data /data && \
chmod a+x /run.sh
# set environment
ENV PORT=8099 \
NODE_ENV=production \
ADDON=true
CMD [ "/run.sh" ]