-
Notifications
You must be signed in to change notification settings - Fork 18
/
Dockerfile
41 lines (28 loc) · 937 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
# Common Stage
FROM node:18-alpine as base
LABEL maintainer="fmartinou"
WORKDIR /home/node/app
ENV LOG_FORMAT=text
## Add TZDATA to allow easy local time configuration
RUN apk add --no-cache tzdata
# Dependencies stage
FROM base as dependencies
COPY app/package*.json app/index.js ./
RUN apk update
RUN apk add --no-cache --virtual build_tools make gcc g++ python3 linux-headers udev
RUN npm ci --omit=dev --no-audit --omit=optional --no-update-notifier
# Do not used prebuilt packages because of issues with serialport on arm
RUN npm rebuild --build-from-source
RUN apk del build_tools
# Release stage
FROM base as release
## Copy node_modules
COPY --from=dependencies /home/node/app/node_modules ./node_modules
## Default entrypoint
COPY Docker.entrypoint.sh /usr/bin/entrypoint.sh
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
## Copy app
COPY app/ ./
## Default Command
CMD ["node", "index"]