-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
83 lines (61 loc) · 1.31 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
FROM hexpm/elixir:1.15.7-erlang-26.1.2-alpine-3.18.4 AS build
# install build dependencies
RUN \
apk add --no-cache \
build-base \
npm \
git \
make \
cmake \
openssl-dev \
ffmpeg-dev \
clang-dev \
libsrtp-dev \
libjpeg-turbo-dev
ARG VERSION
ENV VERSION=${VERSION}
ENV DOCKER_BUILD=true
ARG ERL_FLAGS
ENV ERL_FLAGS=$ERL_FLAGS
# Create build workdir
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
COPY assets assets
COPY apps apps
COPY rel rel
RUN mix deps.get
RUN mix deps.compile
# compile and build release
RUN mix do compile, release
# prepare release image
FROM alpine:3.18.5 AS app
# install runtime dependencies
RUN \
apk add --no-cache \
openssl \
ncurses-libs \
ffmpeg \
clang \
curl \
libsrtp \
libjpeg-turbo \
coreutils
WORKDIR /app
RUN mkdir /var/lib/ex_nvr
RUN chown nobody:nobody /app /var/lib/ex_nvr
USER nobody:nobody
COPY --from=build --chown=nobody:nobody /app/_build/prod/rel/ex_nvr ./
ENV HOME=/app
EXPOSE 4000
HEALTHCHECK CMD curl --fail http://localhost:4000 || exit 1
COPY --chown=nobody:nobody entrypoint.sh ./entrypoint.sh
RUN chmod +x entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]
CMD ["bin/ex_nvr", "start"]