-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (37 loc) · 1.01 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
# Stage 1: Build the Elixir/Phoenix app
FROM hexpm/elixir:1.17.3-erlang-26.2.5.3-debian-bookworm-20240926-slim AS builder
ENV MIX_ENV=prod
WORKDIR /app
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
git \
curl
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN rustup default stable
RUN rustup target add x86_64-unknown-linux-musl
RUN mix local.hex --force && \
mix local.rebar --force
COPY mix.exs mix.lock ./
COPY native native
RUN mix deps.get
COPY config config
COPY rel rel
COPY lib lib
RUN mix compile
RUN mix release
# Stage 2: Create the release image
FROM debian:bookworm-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends \
openssl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/_build/prod/rel ./
ENV HOME=/app
ENV PORT=4000
EXPOSE $PORT
ENV PHX_SERVER=true
CMD ["rolling_stats/bin/rolling_stats", "start"]