-
-
Notifications
You must be signed in to change notification settings - Fork 266
/
Dockerfile
87 lines (64 loc) · 1.77 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
ARG ALPINE_VERSION=3.18.0
ARG ERLANG_OTP_VERSION=25.2.2
ARG ELIXIR_VERSION=1.14.3
## Release building image
# https://github.com/hexpm/bob#docker-images
FROM docker.io/hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_OTP_VERSION}-alpine-${ALPINE_VERSION} as builder
ARG VERSION
ARG MIX_ENV=prod
ENV ERL_FLAGS="+JPperf true"
# Avoid "error 137" (out of memory) while building images
# See https://github.com/rust-lang/cargo/issues/10781
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL="sparse"
WORKDIR /opt/app
RUN apk upgrade && \
apk add \
nodejs \
npm \
rust \
cargo \
build-base && \
mix local.rebar --force && \
mix local.hex --force
COPY native native/
RUN cd native/vt_nif && cargo build -r
COPY mix.* ./
RUN mix do deps.get --only prod, deps.compile
COPY assets/ assets/
RUN cd assets && \
npm install && \
env NODE_OPTIONS=--openssl-legacy-provider npm run deploy
COPY config/config.exs config/
COPY config/prod.exs config/
# ensure mime is recompiled later with our additional mime types
RUN mix deps.clean mime --build
RUN mix phx.digest
COPY config/*.exs config/
COPY lib lib/
COPY priv priv/
# recompile sentry with our source code
RUN mix deps.compile sentry --force
COPY rel rel/
RUN mix release
# Final image
FROM docker.io/alpine:${ALPINE_VERSION}
RUN apk add --no-cache \
libstdc++ \
tini \
bash \
ca-certificates \
rsvg-convert \
ttf-dejavu \
pngquant
WORKDIR /opt/app
COPY --from=builder /opt/app/_build/prod/rel/asciinema .
RUN chgrp -R 0 /opt/app && chmod -R g=u /opt/app
COPY .iex.exs .
ENV PORT=4000 \
ADMIN_BIND_ALL=1 \
DATABASE_URL=postgresql://postgres@postgres/postgres \
RSVG_FONT_FAMILY="Dejavu Sans Mono" \
PATH=/opt/app/bin:${PATH}
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/opt/app/bin/server"]
EXPOSE 4000