# export APP_IMAGE=distro-with-glibc-2.17-or-greater:myapp # docker build -t ${APP_IMAGE}-df -f Dockerfile.glibc.df # --build-arg "APP_IMAGE=${APP_IMAGE}" --build-arg "DF_APP_NAME=${DF_APP_NAME}" --build-arg "DF_COMPONENT=${DF_COMPONENT}" . ARG APP_IMAGE FROM centos:7 as df-runtime RUN yum -y check-update; yum -y install curl RUN cd /etc/yum.repos.d && curl -LO https://repo.deepfactor.io/repo/yum/deepfactor.repo RUN rpm --import https://repo.deepfactor.io/repo/yum/keys/D5DC8225.asc RUN yum -y install deepfactor-runtime ARG APP_IMAGE ARG DF_APP_NAME ARG DF_COMPONENT ARG DF_RUN_TOKEN # option: pass via build ARG or set here ENV DF_APP "${DF_APP_NAME}" ENV DF_COMPONENT "${DF_COMPONENT}" ENV DF_RUN_TOKEN "${DF_RUN_TOKEN}" # If necessary, add --add-host=my-df-portal:10.0.0.1 to your image build AND run commands for DF portal DNS: RUN mkdir -p /opt/deepfactor/manifest RUN dfctl register -a "$DF_APP" -c "$DF_COMPONENT" -o /opt/deepfactor/manifest/df-manifest.json -v # option: dfctl register/create individual components in container # Warning: The above df-runtime container's built libdf.so install must match # the version of the target container's libc.so. # i.e. APP_IMAGE must contain a glibc >= 2.17 FROM ${APP_IMAGE} COPY --from=df-runtime /usr/bin/dfeventd /usr/bin/dfeventd COPY --from=df-runtime /usr/lib/libdf.so /usr/lib/libdf.so COPY --from=df-runtime /usr/lib/libdf-j.so /usr/lib/libdf-j.so COPY --from=df-runtime /opt/deepfactor/manifest/df-manifest.json /opt/deepfactor/manifest/df-manifest.json # The following is an optional smoke test for redhat and debian distro types. RUN env DF_PKGINFO_QUERY=disable LD_PRELOAD=/usr/lib/libdf.so DF_MANIFEST=/opt/deepfactor/manifest/df-manifest.json sh -c 'rpm -q glibc || dpkg -l libc6' || \ (echo -e "\n\n\nError, DeepFactor dependency not met.\n\n\n/tmp/deepfactor.log:\n" \ && cat /tmp/deepfactor.log && false) # option: set LD_PRELOAD in app startup cmd or script ENV LD_PRELOAD=/usr/lib/libdf.so ENV DF_MANIFEST=/opt/deepfactor/manifest/df-manifest.json