forked from dappnode/DNP_DAPPMANAGER
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.dev
154 lines (127 loc) · 4.11 KB
/
Dockerfile.dev
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
ARG NODE_VERSION=20.3.0
############
# GIT-DATA #
############
FROM --platform=${BUILDPLATFORM:-amd64} node:${NODE_VERSION}-alpine as git-data
WORKDIR /usr/src/app
RUN apk add --no-cache git
COPY .git .git
COPY dappnode_package.json .
COPY docker/getGitData.js .
RUN node getGitData /usr/src/app/.git-data.json
##################
# BUILD-BINARIES #
##################
FROM --platform=${BUILDPLATFORM:-amd64} node:${NODE_VERSION}-alpine as build-binaries
RUN apk add --no-cache bind-tools docker curl
RUN curl -L https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-linux-$(uname -m) > /usr/local/bin/docker-compose \
&& chmod +x /usr/local/bin/docker-compose
# Common base so it's cached
# --platform=$BUILDPLATFORM is used build javascript source with host arch
# Otherwise webpack builds on emulated archs can be extremely slow (+1h)
############################
# BUILD-SRC AND PRODUCTION #
############################
FROM --platform=${BUILDPLATFORM:-amd64} node:${NODE_VERSION}-alpine as build-src
ENV COMPOSE_HTTP_TIMEOUT=300 \
DOCKER_CLIENT_TIMEOUT=300 \
DOCKER_HOST=unix:///var/run/docker.sock \
UI_FILES_PATH=/app/packages/admin-ui/build \
GIT_DATA_PATH=.git-data.json \
TEST=true \
REACT_APP_API_URL=http://172.33.1.7:5000/
WORKDIR /app
RUN apk add --no-cache python3 build-base bash git bind-tools docker \
curl bind-dev xz libltdl miniupnpc zip unzip dbus bind tmux avahi-tools
# Build the src code:
# Copy and install deps first to cache
COPY package.json yarn.lock lerna.json tsconfig.json ./
RUN yarn --frozen-lockfile --non-interactive --ignore-scripts --ignore-optional
COPY packages/admin-ui/package.json \
packages/admin-ui/
COPY packages/dappmanager/package.json \
packages/dappmanager/
COPY packages/common/package.json \
packages/common/
COPY packages/params/package.json \
packages/params/
COPY packages/utils/package.json \
packages/utils/
COPY packages/eventBus/package.json \
packages/eventBus/
COPY packages/logger/package.json \
packages/logger/
COPY packages/dockerCompose/package.json \
packages/dockerCompose/
COPY packages/dockerApi/package.json \
packages/dockerApi/
COPY packages/hostScripts/package.json \
packages/hostScripts/
RUN yarn --frozen-lockfile --non-interactive --ignore-optional
# Build params
WORKDIR /app/packages/params/
COPY packages/params/ .
RUN yarn build
# Results in dist/*
# Build common
WORKDIR /app/packages/common/
COPY packages/common/ .
RUN yarn build
# Results in dist/*
# Build utils
WORKDIR /app/packages/utils/
COPY packages/utils/ .
RUN yarn build
# Results in dist/*
# Build eventBus
WORKDIR /app/packages/eventBus/
COPY packages/eventBus/ .
RUN yarn build
# Results in dist/*
# Build dockerCompose
WORKDIR /app/packages/dockerCompose/
COPY packages/dockerCompose/ .
RUN yarn build
# Results in dist/*
# Build logger
WORKDIR /app/packages/logger/
COPY packages/logger/ .
RUN yarn build
# Results in dist/*
# Build hostScripts
WORKDIR /app/packages/hostScripts/
COPY packages/hostScripts/ .
RUN yarn build
# Results in dist/*
# Build dockerApi
WORKDIR /app/packages/dockerApi/
COPY packages/dockerApi/ .
RUN yarn build
# Results in dist/*
# Build dappmanager
WORKDIR /app/packages/dappmanager/
COPY packages/dappmanager/ .
RUN yarn build
# Results in dist/*
# Build admin-ui
WORKDIR /app/packages/admin-ui/
COPY packages/admin-ui/ .
ENV REACT_APP_API_URL /
RUN yarn build
# Results in build/*
# Copy docker
COPY docker/rndc.conf /etc/bind/
COPY docker/update_local_dyndns.sh /usr/local/bin/update_local_dyndns
# Copy git data
COPY --from=git-data /usr/src/app/.git-data.json $GIT_DATA_PATH
# Copy binaries
COPY --from=build-binaries /usr/bin/nsupdate /usr/bin/nsupdate
COPY --from=build-binaries /usr/bin/docker /usr/bin/docker
COPY --from=build-binaries /usr/local/bin/docker-compose /usr/local/bin/docker-compose
# Copy the src last as it's the layer most likely to change
COPY packages/hostScripts/hostScripts /usr/src/app/hostScripts
COPY docker/rndc.conf /etc/bind/
COPY docker/update_local_dyndns.sh /usr/local/bin/update_local_dyndns
WORKDIR /app
COPY docker/start_dev.sh /usr/src/app/start_dev.sh
ENTRYPOINT [ "/usr/src/app/start_dev.sh" ]