This repository has been archived by the owner on Mar 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
68 lines (52 loc) · 2.21 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
# ╔════════════════════════════════════════════════════════════════════════════╗
# ║ ║
# ║ __ \ | _|_) | ║
# ║ | | _ \ __| | / _ \ __| | | | _ \ ║
# ║ | | ( | ( < __/ | __| | | __/ ║
# ║ ____/ \___/ \___|_|\_\\___|_| _| _|_|\___| ║
# ║ ║
# ║ * github.com/paperwork * twitter.com/paperworkcloud * ║
# ║ ║
# ╚════════════════════════════════════════════════════════════════════════════╝
FROM elixir:1.10-alpine AS basic
ARG APP_NAME
ARG APP_VSN
ARG MIX_ENV=prod
ENV APP_NAME=${APP_NAME} \
APP_VSN=${APP_VSN} \
MIX_ENV=${MIX_ENV}
RUN apk update && \
apk upgrade --no-cache && \
apk add --no-cache \
git \
build-base && \
mix local.rebar --force && \
mix local.hex --force
# ---------------------------------------------------------------------------- #
FROM basic AS builder
ARG APP_NAME
ARG APP_VSN
ARG MIX_ENV=prod
ENV APP_NAME=${APP_NAME} \
APP_VSN=${APP_VSN} \
MIX_ENV=${MIX_ENV} \
REPLACE_OS_VARS=true
WORKDIR /opt/build
COPY . .
RUN mix do deps.get, deps.compile, compile, release
# ---------------------------------------------------------------------------- #
FROM alpine:3.11 AS app
ARG APP_NAME
ARG APP_VSN
ARG MIX_ENV=prod
ENV APP_NAME=${APP_NAME} \
APP_VSN=${APP_VSN} \
MIX_ENV=${MIX_ENV} \
REPLACE_OS_VARS=true
RUN apk update && \
apk add --no-cache \
bash \
openssl-dev
WORKDIR /opt/app
COPY --from=builder /opt/build/_build/${MIX_ENV}/rel/${APP_NAME} .
CMD trap 'exit' INT; /opt/app/bin/${APP_NAME} start