diff --git a/.travis.yml b/.travis.yml index 8825a2e..7bc25f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,8 +29,9 @@ deploy: secure: Yk90ANpSPv1iJy8QDXCPwfaSmEr/WIJ3bzhQ6X8JvZjfrwTosbh0HrUzQyeac3nyvNwj7YJRssolOFc21IBKPpCFTZqYxSkuLPU6ysG4HGHgN6YJhOMm4mG4KKJ6741q3DJendhZpalBhCEi+NcZK/PCSD97Vl4OqRjBUged0fs= file: - "./dist/tini" - - "./dist/tini_0.4.3.deb" - - "./dist/tini_0.4.3.rpm" + - "./dist/tini-static" + - "./dist/tini_0.5.0.deb" + - "./dist/tini_0.5.0.rpm" on: repo: krallin/tini tags: true diff --git a/CMakeLists.txt b/CMakeLists.txt index 935f5a8..0c37706 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,8 @@ project (tini C) # Config set (tini_VERSION_MAJOR 0) -set (tini_VERSION_MINOR 4) -set (tini_VERSION_PATCH 3) +set (tini_VERSION_MINOR 5) +set (tini_VERSION_PATCH 0) execute_process (COMMAND git log -n 1 --date=local --pretty=format:"%h" WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" OUTPUT_VARIABLE tini_VERSION_GIT) # Flags @@ -36,8 +36,12 @@ include_directories ("${PROJECT_BINARY_DIR}") add_executable (tini src/tini.c) +add_executable (tini-static src/tini.c) +set_target_properties (tini-static PROPERTIES LINK_FLAGS "-Wl,--no-export-dynamic -static") + # Installation install (TARGETS tini DESTINATION bin) +install (TARGETS tini-static DESTINATION bin) # Packaging include (InstallRequiredSystemLibraries) diff --git a/README.md b/README.md index 5ca8db6..7e52bd8 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ In Docker, you will want to use an entrypoint so you don't have to remember to manually invoke Tini: # Add Tini - ENV TINI_VERSION v0.4.3 + ENV TINI_VERSION v0.5.0 ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini RUN chmod +x /tini ENTRYPOINT ["/tini", "--"] @@ -63,11 +63,22 @@ Assuming your entrypoint was `/docker-entrypoint.sh`, then you would use: ENTRYPOINT ["/tini", "--", "/docker-entrypoint.sh"] +### Statically-Linked Version ### + +Tini has very few dependencies (it only depends on libc), but if your +container fails to start, you might want to consider using the statically-built +version instead: + + ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /tini + + ### Size Considerations ### Tini is a very small file (in the 10KB range), so it doesn't add much weight to your container. +The statically-linked version is bigger, but still < 1M. + ### Building Tini ### diff --git a/ci/run_build.sh b/ci/run_build.sh index 102072f..ffc4b20 100755 --- a/ci/run_build.sh +++ b/ci/run_build.sh @@ -22,26 +22,27 @@ make package popd # Smoke tests (actual tests need Docker to run; they don't run within the CI environment) -tini="${BUILD_DIR}/tini" -echo "Testing $tini with: true" -$tini -vvvv true +for tini in "${BUILD_DIR}/tini" "${BUILD_DIR}/tini-static"; do + echo "Testing $tini with: true" + $tini -vvvv true -echo "Testing $tini with: false" -if $tini -vvvv false; then - exit 1 -fi + echo "Testing $tini with: false" + if $tini -vvvv false; then + exit 1 + fi -# Place files -mkdir -p "${DIST_DIR}" -cp "${BUILD_DIR}"/tini{,*.rpm,*deb} "${DIST_DIR}" + # Move files to the dist dir for testing + mkdir -p "${DIST_DIR}" + cp "${BUILD_DIR}"/tini{,-static,*.rpm,*deb} "${DIST_DIR}" -# Quick audit -if which rpm; then - echo "Contents for RPM:" - rpm -qlp "${DIST_DIR}/tini"*.rpm -fi + # Quick audit + if which rpm; then + echo "Contents for RPM:" + rpm -qlp "${DIST_DIR}/tini"*.rpm + fi -if which dpkg; then - echo "Contents for DEB:" - dpkg --contents "${DIST_DIR}/tini"*deb -fi + if which dpkg; then + echo "Contents for DEB:" + dpkg --contents "${DIST_DIR}/tini"*deb + fi +done diff --git a/test/test.py b/test/test.py index de8becc..b161dad 100644 --- a/test/test.py +++ b/test/test.py @@ -73,7 +73,7 @@ if __name__ == "__main__": # Funtional tests - for entrypoint in ["/tini/dist/tini"]: + for entrypoint in ["/tini/dist/tini", "/tini/dist/tini-static"]: functional_base_cmd = base_cmd + [ "--entrypoint={0}".format(entrypoint), img, @@ -97,10 +97,11 @@ if __name__ == "__main__": Command(functional_base_cmd + ["--", "zzzz"], fail_cmd).run(retcode=1) Command(functional_base_cmd + ["-h"], fail_cmd).run() - # Valgrind test - Command(functional_base_cmd + ["--", "valgrind", "--leak-check=full", "--error-exitcode=1", entrypoint, "-v", "--", "ls"], fail_cmd).run() + # Valgrind test (we only run this on the dynamic version, because otherwise Valgrind may bring up plenty of errors that are + # actually from libc) + Command(functional_base_cmd + ["--", "valgrind", "--leak-check=full", "--error-exitcode=1", "/tini/dist/tini", "-v", "--", "ls"], fail_cmd).run() - # Install tests (sh -c is used for globbing and &&) + # Installation tests (sh -c is used for globbing and &&) for image, pkg_manager, extension in [ ["ubuntu:precise", "dpkg", "deb"], ["ubuntu:trusty", "dpkg", "deb"], diff --git a/tpl/README.md.in b/tpl/README.md.in index 40d6d1e..547bfac 100644 --- a/tpl/README.md.in +++ b/tpl/README.md.in @@ -63,11 +63,22 @@ Assuming your entrypoint was `/docker-entrypoint.sh`, then you would use: ENTRYPOINT ["/tini", "--", "/docker-entrypoint.sh"] +### Statically-Linked Version ### + +Tini has very few dependencies (it only depends on libc), but if your +container fails to start, you might want to consider using the statically-built +version instead: + + ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /tini + + ### Size Considerations ### Tini is a very small file (in the 10KB range), so it doesn't add much weight to your container. +The statically-linked version is bigger, but still < 1M. + ### Building Tini ### diff --git a/tpl/travis.yml.tpl b/tpl/travis.yml.tpl index 67feea0..2af079c 100644 --- a/tpl/travis.yml.tpl +++ b/tpl/travis.yml.tpl @@ -29,6 +29,7 @@ deploy: secure: Yk90ANpSPv1iJy8QDXCPwfaSmEr/WIJ3bzhQ6X8JvZjfrwTosbh0HrUzQyeac3nyvNwj7YJRssolOFc21IBKPpCFTZqYxSkuLPU6ysG4HGHgN6YJhOMm4mG4KKJ6741q3DJendhZpalBhCEi+NcZK/PCSD97Vl4OqRjBUged0fs= file: - "./dist/tini" + - "./dist/tini-static" - "./dist/tini_@tini_VERSION_MAJOR@.@tini_VERSION_MINOR@.@tini_VERSION_PATCH@.deb" - "./dist/tini_@tini_VERSION_MAJOR@.@tini_VERSION_MINOR@.@tini_VERSION_PATCH@.rpm" on: