packaging for, based on
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.5 KiB

# "The FROM instruction initializes a new build stage and sets the
# Base Image for subsequent instructions."
FROM erlang: as builder
# "The LABEL instruction adds metadata to an image."
LABEL stage=builder
# Install git for fetching non-hex dependencies. Also allows rebar3
# to find it's own git version.
# Add any other Alpine libraries needed to compile the project here.
# See for details
# on the local cache and need for the symlink
RUN ln -s /var/cache/apk /etc/apk/cache && \
apk update && \
apk add --update openssh-client git
# WORKDIR is located in the image
WORKDIR /root/rebar3
# copy the entire src over and build
COPY . .
RUN ./bootstrap
# this is the final runner layer, notice how it diverges from the original erlang
# alpine layer, this means this layer won't have any of the other stuff that was
# generated previously (deps, build, etc)
FROM erlang: as runner
# copy the generated `rebar3` binary over here
COPY --from=builder /root/rebar3/_build/prod/bin/rebar3 .
# and install it
RUN HOME=/opt ./rebar3 local install \
&& rm -f /usr/local/bin/rebar3 \
&& ln /opt/.cache/rebar3/bin/rebar3 /usr/local/bin/rebar3 \
&& rm -rf rebar3
# simply print out the version for visibility
ENTRYPOINT ["/usr/local/bin/rebar3"]
CMD ["--version"]