forked from MauriceNino/dashdot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
86 lines (71 loc) · 2.2 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# BASE #
FROM node:18-alpine AS base
WORKDIR /app
ARG TARGETPLATFORM
ENV DASHDOT_RUNNING_IN_DOCKER=true
RUN \
/bin/echo ">> installing dependencies" &&\
apk update &&\
apk --no-cache add \
lsblk \
mdadm \
dmidecode \
util-linux \
lm-sensors \
speedtest-cli &&\
if [ "$TARGETPLATFORM" = "linux/amd64" ] || [ "$(uname -m)" = "x86_64" ]; \
then \
/bin/echo ">> installing dependencies (amd64)" &&\
wget -qO- https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-linux-x86_64.tgz \
| tar xmoz -C /usr/bin speedtest; \
elif [ "$TARGETPLATFORM" = "linux/arm64" ] || [ "$(uname -m)" = "aarch64" ]; \
then \
/bin/echo ">> installing dependencies (arm64)" &&\
wget -qO- https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-linux-aarch64.tgz \
| tar xmoz -C /usr/bin speedtest &&\
apk --no-cache add raspberrypi; \
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; \
then \
/bin/echo ">> installing dependencies (arm/v7)" &&\
wget -qO- https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-linux-armhf.tgz \
| tar xmoz -C /usr/bin speedtest &&\
apk --no-cache add raspberrypi; \
else /bin/echo "Unsupported platform"; exit 1; \
fi
# DEV #
FROM base AS dev
EXPOSE 3001
EXPOSE 3000
RUN \
/bin/echo -e ">> installing dependencies (dev)" &&\
apk --no-cache add \
git &&\
git config --global --add safe.directory /app
# BUILD #
FROM base as build
ARG BUILDHASH
ARG VERSION
ENV NX_DAEMON=false
RUN \
/bin/echo -e ">> installing dependencies (build)" &&\
apk --no-cache add \
git \
make \
clang \
build-base &&\
git config --global --add safe.directory /app &&\
/bin/echo -e "{\"version\":\"$VERSION\",\"buildhash\":\"$BUILDHASH\"}" > /app/version.json
COPY . ./
RUN \
yarn --immutable --immutable-cache &&\
yarn build:prod
# PROD #
FROM base as prod
EXPOSE 3001
COPY --from=build /app/package.json .
COPY --from=build /app/version.json .
COPY --from=build /app/.yarn/releases/ .yarn/releases/
COPY --from=build /app/dist/apps/server dist/apps/server
COPY --from=build /app/dist/apps/cli dist/apps/cli
COPY --from=build /app/dist/apps/view dist/apps/view
CMD ["yarn", "start"]