forked from asciinema/asciinema-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
82 lines (59 loc) · 1.48 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
ARG ALPINE_VERSION=3.15.3
ARG ERLANG_OTP_VERSION=24.3.3
ARG ELIXIR_VERSION=1.13.4
## Release building image
# https://github.com/hexpm/bob#docker-images
FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_OTP_VERSION}-alpine-${ALPINE_VERSION} as builder
ARG MIX_ENV=prod
WORKDIR /opt/app
RUN apk upgrade && \
apk add \
nodejs \
npm \
rust \
cargo \
build-base && \
mix local.rebar --force && \
mix local.hex --force
COPY mix.* ./
RUN mix do deps.get --only prod, deps.compile
COPY assets/ assets/
RUN cd assets && \
npm install && \
npm run deploy
COPY config/config.exs config/
COPY config/prod.exs config/
RUN mix phx.digest
COPY config/*.exs config/
COPY lib lib/
COPY priv priv/
COPY native native/
# recompile sentry with our source code
RUN mix deps.compile sentry --force
COPY rel rel/
# temporary workaround to make rustler work with OTP 24
ENV RUSTLER_NIF_VERSION 2.15
RUN mix release
# Final image
FROM alpine:${ALPINE_VERSION}
RUN apk add --no-cache \
libstdc++ \
tini \
bash \
ca-certificates \
librsvg \
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
ENV DATABASE_URL "postgresql://postgres@postgres/postgres"
ENV RSVG_FONT_FAMILY "Dejavu Sans Mono"
ENV PATH "/opt/app/bin:${PATH}"
VOLUME /opt/app/uploads
VOLUME /opt/app/cache
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/opt/app/bin/asciinema", "start"]
EXPOSE 4000