-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile-proxy
64 lines (44 loc) · 1.46 KB
/
Dockerfile-proxy
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
FROM elixir:1.15-alpine AS builder
ENV MIX_ENV=prod
WORKDIR /app
RUN apk add --no-cache --update git build-base ca-certificates zstd gcc pkgconfig openssl-dev
RUN mkdir config
COPY config/ ./config
COPY spawn_proxy/ ./spawn_proxy
COPY lib/ ./lib
COPY spawn_statestores/ ./spawn_statestores
COPY priv/ ./priv
COPY mix.exs .
COPY mix.lock .
RUN mix local.rebar --force \
&& mix local.hex --force \
&& mix deps.get \
&& mix release.init
ENV RELEASE_DISTRIBUTION="name"
# Overriden at runtime
ENV POD_IP="127.0.0.1"
# This will be the basename of node
ENV RELEASE_NAME="proxy"
# This will be the full nodename
ENV RELEASE_NODE="${RELEASE_NAME}@${POD_IP}"
#RUN echo "-setcookie ${RELEASE_COOKIE}" >> ./priv/rel/vm.args.eex
RUN cd spawn_proxy/proxy \
&& mix deps.get \
&& mix release proxy
# ---- Application Stage ----
FROM alpine:3.20
RUN apk add --no-cache --update zstd ncurses-libs libstdc++ libgcc protobuf
WORKDIR /app
RUN chown nobody /app
# Set runner ENV
ENV MIX_ENV=prod
ENV HOME=/app
COPY rel/overlays/mtls.ssl.conf .
COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/proxy ./
RUN mkdir -p /app/.cache/bakeware/ && chmod 777 /app/.cache/bakeware/
RUN mkdir -p /app/priv/generated_modules/ && chmod 777 /app/priv/generated_modules/
RUN mkdir /data/ && chmod 777 /data/
RUN touch /.erlang.cookie && chmod 777 /.erlang.cookie
RUN touch /app/.erlang.cookie && chmod 777 /app/.erlang.cookie
USER nobody
ENTRYPOINT ["/app/bin/proxy", "start"]