-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
41 lines (27 loc) · 880 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
FROM "elixir:1.18-otp-27-alpine" AS builder
ENV MIX_ENV="prod"
RUN apk add --no-cache build-base git nodejs npm
WORKDIR /app
COPY lib lib
COPY rel rel
COPY priv priv
COPY assets assets
COPY mix.exs mix.lock .
COPY config/config.exs config/runtime.exs config/${MIX_ENV}.exs config/
RUN mix deps.get --only $MIX_ENV
RUN mix assets.setup && mix assets.deploy
RUN mix compile && mix release
FROM "alpine:latest" AS runner
ENV MIX_ENV="prod"
RUN apk add --no-cache libstdc++ openssl ncurses-libs ca-certificates
WORKDIR "/app"
RUN chown nobody /app
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/gems ./
USER nobody
# Make sure that we have the right permissions
# when running the app through docker compose
RUN chmod +x /app/bin/migrate
RUN chmod +x /app/bin/seeds
RUN chmod +x /app/bin/server
RUN chmod +x /app/bin/start
CMD ["/app/bin/start"]