-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDockerfile
49 lines (41 loc) · 1.08 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
# BUILD LAYER
FROM hexpm/elixir:1.16.1-erlang-26.2.2-alpine-3.18.6 AS build
RUN apk add --no-cache build-base npm gcompat
WORKDIR /app
## HEX
ENV HEX_HTTP_TIMEOUT=20
RUN mix local.hex --if-missing --force && \
mix local.rebar
ENV MIX_ENV=prod
ENV SECRET_KEY_BASE=nokeyyet
## COMPILE
COPY mix.exs mix.lock ./
COPY config/config.exs ./config/config.exs
COPY VERSION .
COPY config/prod.exs ./config/prod.exs
RUN mix deps.get --only prod
RUN mix do tailwind.install, esbuild.install
RUN mix deps.compile
## BUILD RELEASE
COPY assets ./assets
COPY lib ./lib
COPY rel ./rel
COPY posts ./posts
COPY priv ./priv
RUN npm --prefix ./assets ci --progress=false --no-audit --loglevel=error
RUN mix assets.deploy
COPY config/runtime.exs ./config/runtime.exs
RUN mix release
# APP LAYER
FROM alpine:3.18.6 AS app
RUN apk add --no-cache libstdc++ openssl ncurses-libs
WORKDIR /app
RUN chown nobody:nobody /app
USER nobody:nobody
## COPY RELEASE
COPY --from=build --chown=nobody:nobody app/_build/prod/rel/bern ./
ENV HOME=/app
ENV MIX_ENV=prod
ENV SECRET_KEY_BASE=nokeyyet
ENV PORT=4000
CMD ["bin/bern", "start"]