-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
57 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
FROM elixir:1.8-slim AS builder
ARG APP_NAME=cors_proxy
ARG APP_VSN=0.1.0
ARG MIX_ENV=prod
ENV APP_NAME=${APP_NAME} \
APP_VSN=${APP_VSN} \
MIX_ENV=${MIX_ENV}
WORKDIR /opt/app
RUN apt-get update -y && \
apt-get install git build-essential curl -y && \
mix local.rebar --force && \
mix local.hex --force
COPY ./ /opt/app
WORKDIR /opt/app
RUN mix do deps.get, deps.compile, compile
RUN \
mkdir -p /opt/built && \
mix distillery.release --verbose && \
cp /opt/app/_build/${MIX_ENV}/rel/${APP_NAME}/releases/${APP_VSN}/${APP_NAME}.tar.gz /opt/built && \
cd /opt/built && \
tar -xzf ${APP_NAME}.tar.gz && \
rm ${APP_NAME}.tar.gz
# From this line onwards, we're in a new image, which will be the image used in production
FROM debian:stretch-slim
EXPOSE 80
ARG APP_NAME=cors_proxy
RUN apt-get update -y && \
apt-get install -y \
bash \
openssl \
libssl-dev
ENV REPLACE_OS_VARS=true \
APP_NAME=${APP_NAME} \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8
WORKDIR /opt/app
ENTRYPOINT []
COPY --from=builder /opt/built .
CMD trap 'exit' INT; /opt/app/bin/${APP_NAME} foreground