-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
71 lines (58 loc) · 1.52 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
##
## build base image
##
FROM elixir:1.7.4-alpine AS base
LABEL project="kerbal_maps"
ENV DOCKER_APP_ROOT=/app MIX_ENV=prod PORT=8080
EXPOSE $PORT
WORKDIR $DOCKER_APP_ROOT
RUN apk update && \
apk upgrade --no-cache && \
apk add --no-cache \
bash \
curl && \
addgroup elixir && \
adduser -G elixir -s /bin/sh -D elixir && \
chown elixir:elixir $DOCKER_APP_ROOT
##
## get dependencies
##
FROM base AS sidecar
RUN apk add --no-cache \
build-base \
ca-certificates \
gcc \
git \
jq \
make \
nodejs \
yarn && \
update-ca-certificates
##
## copy application files
##
FROM sidecar AS application_files
COPY --chown=elixir:elixir . $DOCKER_APP_ROOT
USER elixir
##
## build
##
FROM application_files AS builder
RUN mix local.hex --force
RUN mix local.rebar --force
RUN rm -f config/kerbal-maps.conf
RUN mix do deps.get, deps.compile, compile
RUN cd assets && \
yarn install && \
yarn deploy && \
cd .. && \
mix phx.digest
RUN mix release
##
## release
##
FROM base AS final
COPY --chown=elixir:elixir --from=builder $DOCKER_APP_ROOT/rel rel
# CMD trap 'exit' INT; /opt/app/bin/${APP_NAME} foreground
ENTRYPOINT ["/app/rel/kerbal_maps/bin/kerbal_maps"]
CMD ["foreground"]