This repository has been archived by the owner on May 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
59 lines (47 loc) · 1.42 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
##
# BUILD STAGE
# ===========
FROM elixir:1.14-otp-24-alpine AS build
# Install build deps
RUN apk update && \
apk add --no-cache bash build-base curl git libgcc python3
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV RUSTUP_HOME=/root/.rustup \
RUSTFLAGS="-C target-feature=-crt-static" \
CARGO_HOME=/root/.cargo \
PATH="/root/.cargo/bin:$PATH"
# Prepare build
WORKDIR /build
ENV HOME=/build
ENV MIX_ENV=prod
ARG FORCE_RUST_BUILD=0
ENV RUSTLER_PRECOMPILATION_EXAMPLE_BUILD=${FORCE_RUST_BUILD}
# Install Hex and Rebar
RUN mix local.hex --force && \
mix local.rebar --force
# Install mix dependencies
COPY mix.exs mix.lock ./
COPY config config
RUN mix do deps.get, deps.compile
# Compile app
COPY lib lib
COPY priv priv
RUN mix compile
RUN mix release
##
# APP STAGE
# =========
FROM alpine:3.16 AS app
LABEL org.opencontainers.image.title="Nex"
LABEL org.opencontainers.image.description="Nex is a performance nostr relay, written in Elixir"
LABEL org.opencontainers.image.source="https://github.com/lebrunel/nex"
LABEL org.opencontainers.image.source="https://hexdocs.pm/nex"
LABEL org.opencontainers.image.authors="lebrunel"
LABEL org.opencontainers.image.licenses="Apache-2.0"
# Runtime deps
RUN apk update && \
apk add --no-cache bash libgcc libstdc++ ncurses-libs openssl-dev
RUN mkdir /app
WORKDIR /app
COPY --from=build /build/_build/prod/rel/nex ./
CMD ["bin/nex", "start"]