Skip to content

Commit

Permalink
refactor: Dockerfile (includes OTP update) (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
NobbZ committed Jul 17, 2023
1 parent 9241e50 commit c101846
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
FROM erlang:21-alpine AS build
FROM hexpm/erlang:25.3.2.3-alpine-3.18.2 AS erlang

WORKDIR /root
WORKDIR /app
ENV REBAR_VERSION=3.22.0

ADD . /root
FROM erlang AS downloader

RUN rebar3 escriptize
RUN apk --no-cache add curl; \
mkdir -p /tmp/tools; \
curl -L https://github.com/erlang/rebar3/releases/download/${REBAR_VERSION}/rebar3 > /tmp/tools/rebar3; \
chmod +x /tmp/tools/*

FROM erlang:21-alpine
FROM erlang AS build

COPY --from=build /root/_build/default/bin/erlang_analyzer /opt/analyzer/bin/erlang_analyzer
COPY _docker/analyze.sh /opt/analyzer/bin/analyze.sh
COPY --from=downloader /tmp/tools/rebar3 rebar3
COPY rebar.config rebar.lock ./

RUN ./rebar3 get-deps

COPY src/ src/

RUN ./rebar3 escriptize

FROM erlang

COPY --from=build /app/_build/default/bin/erlang_analyzer /opt/analyzer/bin/erlang_analyzer
COPY _docker/analyze.sh /opt/analyzer/bin/analyze.sh

ENTRYPOINT ["/opt/analyzer/bin/analyze.sh"]

0 comments on commit c101846

Please sign in to comment.