-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathDockerfile
64 lines (39 loc) · 1.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
FROM hexpm/elixir:1.11.4-erlang-23.3.4.1-ubuntu-xenial-20210114 AS build
SHELL ["/bin/bash", "-c"]
# install build dependencies
RUN apt-get install -y npm git curl
RUN curl -fsSL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get install -y nodejs
RUN npm install npm@latest -g && \
npm install -g webpack
# prepare build dir
WORKDIR /app
# set build ENV
ENV MIX_ENV=prod
# install mix dependencies
COPY mix.exs mix.lock ./
COPY config ./config
RUN mix local.hex --force && \
mix local.rebar --force && \
mix deps.get --only prod && \
mix deps.compile
# build assets
COPY assets/package.json assets/package-lock.json ./assets/
RUN npm --prefix ./assets ci --progress=false --no-audit --loglevel=error
COPY lib lib
COPY priv priv
COPY assets assets
RUN npm run deploy --prefix ./assets && \
mix phx.digest priv/static
# compile and build release
RUN mix do compile, release
FROM hexpm/elixir:1.11.4-erlang-23.3.4.1-ubuntu-xenial-20210114 AS app
RUN apt install -y sqlite3
ENV LANG=C.UTF-8
WORKDIR /app
COPY --from=build /app/_build/prod/rel/noted ./
ENV HOME=/app
COPY entrypoint.sh ./entrypoint.sh
RUN chmod a+x entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]
CMD ["run"]