mtproto_proxy/Dockerfile
Sergey Prokhorov 90cc0423ad
docker: upgrade to erlang:27-alpine and alpine:3.22
- Builder: erlang:21-alpine -> erlang:27-alpine (OTP 25+ required)
- Runtime: alpine:3.9 -> alpine:3.22 (matches builder's Alpine for ERTS ABI compatibility)
- Use ./rebar3 (project-bundled) instead of system rebar3
- Consolidate apk add calls in runtime stage
- Add libstdc++ to runtime: OTP 24+ JIT compiler (beam.smp) links against
  libstdc++ and libgcc_s, which are not present in the base Alpine image

Tested: built and pushed seriyps/mtproto-proxy:0.8.3 and :latest to Docker Hub.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-07 01:00:34 +02:00

28 lines
900 B
Docker

# Based on https://github.com/erlang/docker-erlang-example
FROM erlang:27-alpine AS builder
RUN apk add --no-cache git
RUN mkdir -p /build/mtproto_proxy
WORKDIR /build/mtproto_proxy
COPY src src
COPY rebar3 rebar3
COPY rebar.config rebar.config
COPY rebar.lock rebar.lock
COPY config config
RUN if [ ! -f config/prod-sys.config ]; then cp config/sys.config.example config/prod-sys.config; fi
RUN if [ ! -f config/prod-vm.args ]; then cp config/vm.args.example config/prod-vm.args; fi
RUN ./rebar3 as prod release
# Must match the Alpine version used by erlang:27-alpine to ensure ERTS ABI compatibility
FROM alpine:3.22
RUN apk add --no-cache openssl ncurses-libs dumb-init libstdc++
RUN mkdir -p /opt /var/log/mtproto-proxy
COPY start.sh /bin/start.sh
COPY --from=builder /build/mtproto_proxy/_build/prod/rel/mtp_proxy /opt/mtp_proxy
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/bin/start.sh"]