-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
51 lines (38 loc) · 971 Bytes
/
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
FROM elixir:1.14.1-alpine as build
# install build dependencies
RUN apk add --update git build-base nodejs npm yarn python3
# prepare build dir
RUN mkdir /app
WORKDIR /app
# install hex + rebar
RUN mix local.hex --force && \
mix local.rebar --force
# set build ENV
ENV MIX_ENV=prod
# install mix dependencies
COPY mix.exs mix.lock ./
COPY config config
RUN mix deps.get
RUN mix deps.compile
# build assets
COPY assets assets
COPY priv priv
RUN cd assets && npm install && npm run deploy
RUN mix phx.digest
# build project
COPY lib lib
RUN mix compile
# build release (uncomment COPY if rel/ exists)
# COPY rel rel
RUN mix release
# prepare release image
FROM alpine:3.16 as app
RUN apk upgrade --no-cache && apk add --update bash openssl libgcc libstdc++ ncurses-libs
RUN mkdir /app
WORKDIR /app
COPY --from=build /app/_build/prod/rel/coliving ./
RUN chown -R nobody: /app
USER nobody
EXPOSE 4004
ENV HOME=/app
CMD ["bash", "/app/bin/coliving", "start"]