-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
58 lines (39 loc) · 1.12 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
FROM elixir:1.13.4-alpine AS builder
ARG BUILD_ENV=prod
ARG BUILD_REL=my_app
# Install system dependencies
RUN mix local.hex --force
RUN mix local.rebar --force
# Add sources
ADD . /workspace/
WORKDIR /workspace
ENV MIX_ENV=${BUILD_ENV}
# Fetch dependencies
RUN mix deps.get
# Build project
RUN mix compile
# Run test-suite
RUN mix test --cover
# Build release
RUN mix release ${BUILD_REL}
FROM alpine:latest AS runner
ARG BUILD_ENV=prod
ARG BUILD_REL=my_app
# Install system dependencies
RUN apk add --no-cache openssl ncurses-libs libgcc libstdc++
# Install release
COPY --from=builder /workspace/_build/${BUILD_ENV}/rel/${BUILD_REL} /opt/myapp
## Configure environment
# We want a FQDN in the nodename
ENV RELEASE_DISTRIBUTION="name"
# This value should be overriden at runtime
ENV RELEASE_IP="127.0.0.1"
# This will be the basename of our node
ENV RELEASE_NAME="${BUILD_REL}"
# This will be the full nodename
ENV RELEASE_NODE="${RELEASE_NAME}@${RELEASE_IP}"
# If empty, the default cookie generated by `mix release` will be used
# OVERRIDE IT!!
ENV RELEASE_COOKIE=""
ENTRYPOINT ["/opt/myapp/bin/${BUILD_REL}"]
CMD ["start"]