Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

42 řádky
1.5 KiB

  1. # https://docs.docker.com/engine/reference/builder/#from
  2. # "The FROM instruction initializes a new build stage and sets the
  3. # Base Image for subsequent instructions."
  4. FROM erlang:20.3.8.1-alpine as builder
  5. # https://docs.docker.com/engine/reference/builder/#label
  6. # "The LABEL instruction adds metadata to an image."
  7. LABEL stage=builder
  8. # Install git for fetching non-hex depenencies. Also allows rebar3
  9. # to find it's own git version.
  10. # Add any other Alpine libraries needed to compile the project here.
  11. # See https://wiki.alpinelinux.org/wiki/Local_APK_cache for details
  12. # on the local cache and need for the symlink
  13. RUN ln -s /var/cache/apk /etc/apk/cache && \
  14. apk update && \
  15. apk add --update openssh-client git
  16. # WORKDIR is located in the image
  17. # https://docs.docker.com/engine/reference/builder/#workdir
  18. WORKDIR /root/rebar3
  19. # copy the entire src over and build
  20. COPY . .
  21. RUN ./bootstrap
  22. # this is the final runner layer, notice how it diverges from the original erlang
  23. # alpine layer, this means this layer won't have any of the other stuff that was
  24. # generated previously (deps, build, etc)
  25. FROM erlang:20.3.8.1-alpine as runner
  26. # copy the generated `rebar3` binary over here
  27. COPY --from=builder /root/rebar3/_build/prod/bin/rebar3 .
  28. # and install it
  29. RUN HOME=/opt ./rebar3 local install \
  30. && ln /opt/.cache/rebar3/bin/rebar3 /usr/local/bin/rebar3 \
  31. && rm -rf rebar3
  32. # simply print out the version for visibility
  33. ENTRYPOINT ["/usr/local/bin/rebar3"]
  34. CMD ["--version"]