forked from diva-exchange/divachain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
62 lines (53 loc) · 2.14 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
#
# Copyright (C) 2021-2022 diva.exchange
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Author/Maintainer: DIVA.EXCHANGE Association <[email protected]>
#
FROM node:14-slim AS build
LABEL author="DIVA.EXCHANGE Association <[email protected]>" \
maintainer="DIVA.EXCHANGE Association <[email protected]>" \
name="divachain" \
description="Distributed digital value exchange upholding security, reliability and privacy" \
url="https://diva.exchange"
#############################################
# First stage: container used to build the binary
#############################################
COPY bin /divachain/bin
COPY src /divachain/src
COPY genesis /divachain/genesis
COPY package.json /divachain/package.json
COPY tsconfig.json /divachain/tsconfig.json
RUN mkdir /genesis-empty-mount \
&& mkdir /keys-empty-mount
RUN cd divachain \
&& mkdir build \
&& mkdir keys \
&& mkdir dist \
&& npm i -g pkg \
&& npm i --production \
&& bin/build.sh
#############################################
# Second stage: create the distroless image
#############################################
FROM gcr.io/distroless/cc
COPY package.json /package.json
# Copy the binary and the prebuilt dependencies
COPY --from=build /divachain/build/divachain-linux-x64 /divachain
COPY --from=build /divachain/build/prebuilds /prebuilds
# genesis and keys folder are just created empty - the content must be provided externally (like: a volume mount)
COPY --from=build /genesis-empty-mount /genesis
COPY --from=build /keys-empty-mount /keys
CMD [ "/divachain" ]