Skip to content

Revised onbuild images #47

@tsloughter

Description

@tsloughter

I was trying out multi-stage builds and wanted to create a generic onbuild image others could use to build their minimal release images.

I think this would be a more appropriate onbuild set of instructions that what current exists:

ONBUILD WORKDIR /usr/src/app
ONBUILD COPY . /usr/src/app
ONBUILD RUN rebar3 as prod tar

ONBUILD RUN mkdir -p /opt/rel
ONBUILD RUN tar -zxvf /usr/src/app/_build/prod/rel/*/*.tar.gz -C /opt/rel

The use of tar is important because of how Erlang target systems are built that changes around a few things from just the built release and use of the prod profile so the user can specify how they want their project built for production.

Then the user can make their Dockerfile (with docker 17.05 and above):

FROM erlang:19.3.3-onbuild as builder

FROM ubuntu:16.04

ENV RELX_REPLACE_OS_VARS true
<any ENV vars they want defaults set of>

WORKDIR /opt/<RELEASE NAME>
COPY --from=builder /opt/rel /opt/<RELEASE NAME>
ENTRYPOINT ["/opt/<RELEASE NAME>/bin/<RELEASE NAME>"]

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions