From 30a79ab0611a906e30b5a4e5c12e7bc66e3e4d30 Mon Sep 17 00:00:00 2001 From: boy Date: Wed, 20 Jul 2022 18:02:09 +0200 Subject: [PATCH] multi-stage dockerfile --- Dockerfile | 41 ++++++++++++++++++++++------------------- ingest-tools/event | 2 +- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0f30ff9..5bda8f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,28 @@ -# Alpine Dockerfile for building locally / pushing to Dockerhub -FROM alpine:3.16 +# syntax=docker/dockerfile:1 +FROM alpine:3.16 AS builder -# install dependencies -RUN buildDeps="bash-completion \ - cmake \ - coreutils \ - gcc \ - g++ \ - gdb \ - git \ - make \ - curl-dev" && \ - apk add --update ${buildDeps} +# Install dependencies +ARG build_deps="bash-completion cmake coreutils gcc g++ gdb git make curl-dev" +RUN apk --no-cache add --update ${build_deps} -# Pull fmp4ingest-tools repo -RUN cd /root && \ - git clone --recurse-submodules https://github.com/unifiedstreaming/fmp4-ingest.git && \ - cd fmp4-ingest/ingest-tools && \ - cmake CMakeLists.txt && \ - make +# Pull fmp4-ingest tools repo +WORKDIR /root/ +RUN git clone --recurse-submodules https://github.com/unifiedstreaming/fmp4-ingest.git +WORKDIR /root/fmp4-ingest/ingest-tools/event/ +RUN git pull https://github.com/unifiedstreaming/EventMessageTrack.git master +# Build fmp4-ingest tools +WORKDIR /root/fmp4-ingest/ +RUN cmake -S . -B build +RUN cmake --build build --clean-first + +# Create lean fmp4-ingest container image +FROM alpine:3.16 + +ARG runtime_deps="gcc curl-dev" +RUN apk --no-cache add --update ${runtime_deps} +WORKDIR /root/fmp4-ingest/ +COPY --from=builder /root/fmp4-ingest/build ./ ENV PATH="${PATH}:/root/fmp4-ingest/ingest-tools:/root/fmp4-ingest/ingest-tools/event" # Invocation examples diff --git a/ingest-tools/event b/ingest-tools/event index 3d0273e..a09b612 160000 --- a/ingest-tools/event +++ b/ingest-tools/event @@ -1 +1 @@ -Subproject commit 3d0273ece0c679093ace3b67bf159bcfeeb5f2e4 +Subproject commit a09b61258f9e00faaf1d2cf519f58822649a0ee4