-
Notifications
You must be signed in to change notification settings - Fork 22
/
Dockerfile
100 lines (77 loc) · 2.23 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
FROM elixir:1.14.1-alpine AS archethic-ci
ARG with_tests=1
ARG MIX_ENV=prod
ARG USER_ID
ARG GROUP_ID
# CI
# - compile
# - release
# - gen PLT
# running CI with proposal should generate release upgrade
# - commit proposal
# - compile
# - run ci
# - generate release upgrade
######### TODO
# TESTNET
# - code
# - release
ENV ARCHETHIC_NETWORK_TYPE=testnet
RUN apk add --no-cache --update \
build-base \
grep \
bash \
gcc \
make \
g++ \
git \
npm \
wget \
openssl \
libsodium-dev \
libexecinfo-dev \
gmp-dev
# https://github.com/cargosense/dart_sass#compatibility-with-alpine-linux-mix-sass-default-exited-with-2
ENV GLIBC_VERSION=2.34-r0
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub &&\
wget -q -O /tmp/glibc.apk https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk &&\
apk add --force-overwrite /tmp/glibc.apk &&\
rm -rf /tmp/glibc.apk
# Install hex and rebar
RUN mix local.rebar --force &&\
mix local.hex --if-missing --force
WORKDIR /opt/code
# install mix dependencies
COPY mix.exs mix.lock ./
COPY config ./config
RUN mix do deps.get, deps.compile
# build assets
COPY priv ./priv
COPY assets ./assets
RUN npm --prefix ./assets ci --progress=false --no-audit --loglevel=error
COPY . .
RUN git config user.name aebot &&\
git config user.email [email protected] &&\
git remote add origin https://github.com/archethic-foundation/archethic-node
# build release
RUN mix assets.saas
RUN mix assets.deploy
RUN MIX_ENV=${MIX_ENV} mix distillery.release
# Install
RUN mkdir -p /opt/app &&\
tar zxf /opt/code/_build/${MIX_ENV}/rel/archethic_node/releases/*/archethic_node.tar.gz -C /opt/app
CMD /opt/app/bin/archethic_node foreground
################################################################################
FROM archethic-ci as build
FROM elixir:1.14.1-alpine
ARG USER_ID
ARG GROUP_ID
RUN apk add --no-cache --update bash git openssl libsodium libexecinfo miniupnpc
COPY --from=build /opt/app /opt/app
COPY --from=build /opt/code/.git /opt/code/.git
WORKDIR /opt/code
RUN git reset --hard
RUN rm -rf /opt/code/.git
RUN rm -rf /opt/code/priv
WORKDIR /opt/app
CMD /opt/app/bin/archethic_node foreground