-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
62 lines (39 loc) · 1019 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
52
53
54
55
56
57
58
59
60
61
62
ARG MIX_ENV="prod"
FROM elixir:1.14-alpine AS build
# install build dependencies
RUN apk add --no-cache build-base git python3
# prepare build dir
WORKDIR /app
# install hex + rebar
RUN mix local.hex --force && \
mix local.rebar --force
# set build ENV
ARG MIX_ENV
ENV MIX_ENV=$MIX_ENV
COPY .git/ ./.git/
# install mix dependencies
COPY mix.exs mix.lock ./
COPY config config
RUN mix do deps.get --only $MIX_ENV, deps.compile
# compile and build release
COPY lib lib
COPY data data
COPY priv priv
# uncomment COPY if rel/ exists
# COPY rel rel
RUN mix do compile, release
# prepare release image
FROM alpine:3.17 AS app
ARG MIX_ENV
RUN apk add --no-cache openssl ncurses-libs
# add imagemagick support
RUN apk add --no-cache file imagemagick
WORKDIR /app
RUN chown nobody:nobody /app
USER nobody:nobody
RUN mkdir -p /app/priv/uploads
VOLUME ["/app/priv/uploads"]
COPY --from=build --chown=nobody:nobody /app/_build/$MIX_ENV/rel/bokken ./
ENV HOME=/app
ENTRYPOINT ["bin/bokken"]
CMD ["start"]