-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
74 lines (54 loc) · 1.7 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
FROM elixir:1.15-alpine as build
# install build dependencies
RUN apk add --update git build-base nodejs python3 npm
# prepare build dir
RUN mkdir /app
WORKDIR /app
# install hex + rebar
RUN mix local.hex --force && \
mix local.rebar --force
# set build ENV
ENV MIX_ENV=prod
# install mix dependencies
COPY mix.exs mix.lock ./
## Umbrella Version
COPY ./apps/demon_spirit_web/mix.exs ./apps/demon_spirit_web/mix.exs
COPY ./apps/demon_spirit/mix.exs ./apps/demon_spirit/mix.exs
COPY ./apps/demon_spirit_game/mix.exs ./apps/demon_spirit_game/mix.exs
COPY config config
RUN mix deps.get
RUN mix deps.compile
# build assets
# COPY assets assets
# RUN cd assets && npm install && npm run deploy
# RUN mix phx.digest
## Umbrella Version
COPY apps/demon_spirit_web/assets apps/demon_spirit_web/assets
# build project
#COPY priv priv
## Umbrella Version
COPY ./apps/demon_spirit_web/priv ./apps/demon_spirit_web/priv
#COPY lib lib
## Umbrella Version
COPY apps/demon_spirit_game/lib/ apps/demon_spirit_game/lib/
COPY apps/demon_spirit/lib/ apps/demon_spirit/lib/
COPY apps/demon_spirit_web/lib/ apps/demon_spirit_web/lib/
RUN cd apps/demon_spirit_web/assets && npm install && npm run deploy
RUN mix phx.digest
RUN mix compile
# build release
RUN mix release
#COPY rel rel
# prepare release image
FROM alpine:3.18.4 AS app
RUN apk add --update bash openssl libstdc++ libgcc
RUN mkdir /app
WORKDIR /app
# Change the 'demon_spirit_umbrella' here to the name of the app
COPY --from=build /app/_build/prod/rel/demon_spirit_umbrella ./
RUN chown -R nobody: /app
USER nobody
ENV HOME=/app
## Set on runtime (Preferably this is done out of container)
#ENV SECRET_KEY_BASE ...secret here...
CMD ["bin/demon_spirit_umbrella","start"]