-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile.template
33 lines (23 loc) · 1017 Bytes
/
Dockerfile.template
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
FROM balenalib/%%BALENA_ARCH%%-node:11-buster-build AS build
# Defines our working directory in container
WORKDIR /usr/src/app
# Copies the package.json first for better cache on later pushes
COPY package.json package.json
# This install npm dependencies on the balena build server,
# making sure to clean up the artifacts it creates in order to reduce the image size.
RUN JOBS=MAX npm install --production --unsafe-perm && npm cache verify
FROM balenalib/%%BALENA_ARCH%%-node:11-buster
COPY --from=build /usr/src/app/node_modules node_modules
# Defines our working directory in container
WORKDIR /usr/src/app
# Install dependencies
RUN install_packages rsync
# This will copy all files in our root to the working directory in the container
COPY . ./
# Enable udev for detection of dynamically plugged devices
ENV UDEV=on
COPY udev/usb.rules /etc/udev/rules.d/usb.rules
# Make udev script executable
RUN chmod +x udev/copy.sh
# server.js will run when container starts up on the device
CMD ["npm", "start"]