github.com/goreleaser/nfpm/v2@v2.44.0/testdata/acceptance/apk.dockerfile (about) 1 FROM alpine AS test_base 2 ARG package 3 RUN echo "${package}" 4 COPY ${package} /tmp/foo.apk 5 6 7 # ---- minimal test ---- 8 FROM test_base AS min 9 RUN apk add --allow-untrusted /tmp/foo.apk 10 11 12 # ---- symlink test ---- 13 FROM min AS symlink 14 RUN ls -l /path/to/symlink | grep "/path/to/symlink -> /etc/foo/whatever.conf" 15 16 17 # ---- simple test ---- 18 FROM min AS simple 19 RUN test -e /usr/bin/fake 20 RUN test -f /etc/foo/whatever.conf 21 RUN echo wat >> /etc/foo/whatever.conf 22 RUN apk del foo 23 RUN test -f /etc/foo/whatever.conf 24 RUN test ! -f /usr/bin/fake 25 26 27 # ---- no-glob test ---- 28 FROM min AS no-glob 29 RUN test -d /usr/share/whatever/ 30 RUN test -f /usr/share/whatever/file1 31 RUN test -f /usr/share/whatever/file2 32 RUN test -d /usr/share/whatever/folder2 33 RUN test -f /usr/share/whatever/folder2/file1 34 RUN test -f /usr/share/whatever/folder2/file2 35 36 37 # ---- complex test ---- 38 FROM min AS complex 39 RUN test -e /usr/bin/fake 40 RUN test -f /etc/foo/whatever.conf 41 RUN test -d /usr/share/whatever/ 42 RUN test -d /usr/share/whatever/folder 43 RUN test -f /usr/share/whatever/folder/file1 44 RUN test -f /usr/share/whatever/folder/file2 45 RUN test -d /usr/share/whatever/folder/folder2 46 RUN test -f /usr/share/whatever/folder/folder2/file1 47 RUN test -f /usr/share/whatever/folder/folder2/file2 48 RUN test -d /var/log/whatever 49 RUN test -d /usr/share/foo 50 RUN test -d /usr/foo/bar/something 51 RUN test -d /etc/something 52 RUN test -f /etc/something/a 53 RUN test -f /etc/something/b 54 RUN test -d /etc/something/c 55 RUN test -f /etc/something/c/d 56 RUN test $(stat -c %a /usr/bin/fake2) -eq 4755 57 RUN test -f /tmp/preinstall-proof 58 RUN test -f /tmp/postinstall-proof 59 RUN test ! -f /tmp/preremove-proof 60 RUN test ! -f /tmp/postremove-proof 61 RUN echo wat >> /etc/foo/whatever.conf 62 RUN apk del foo 63 RUN test -f /etc/foo/whatever.conf 64 RUN test ! -f /usr/bin/fake 65 RUN test ! -f /usr/bin/fake2 66 RUN test -f /tmp/preremove-proof 67 RUN test -f /tmp/postremove-proof 68 RUN test ! -d /var/log/whatever 69 RUN test ! -d /usr/share/foo 70 RUN test ! -d /usr/foo/bar/something 71 72 73 # ---- signed test ---- 74 FROM test_base AS signed 75 COPY keys/rsa_unprotected.pub /etc/apk/keys/john@example.com.rsa.pub 76 RUN apk verify /tmp/foo.apk | grep "/tmp/foo.apk: 0 - OK" 77 RUN apk add /tmp/foo.apk 78 79 80 # ---- overrides test ---- 81 FROM min AS overrides 82 RUN test -e /usr/bin/fake 83 RUN test -f /etc/foo/whatever.conf 84 RUN test ! -f /tmp/preinstall-proof 85 RUN test -f /tmp/postinstall-proof 86 RUN test ! -f /tmp/preremove-proof 87 RUN test ! -f /tmp/postremove-proof 88 RUN echo wat >> /etc/foo/whatever.conf 89 RUN apk del foo 90 RUN test -f /etc/foo/whatever.conf 91 RUN test ! -f /usr/bin/fake 92 RUN test -f /tmp/preremove-proof 93 RUN test ! -f /tmp/postremove-proof 94 95 96 # ---- meta test ---- 97 FROM min AS meta 98 RUN command -v zsh 99 100 101 # ---- env-var-version test ---- 102 FROM min AS env-var-version 103 ENV EXPECTVER="foo-1.0.0_0.1.b1-git.abcdefgh description:" 104 RUN apk info foo | grep "foo-" | grep " description:" > found 105 RUN export FOUND_VER="$(cat found)" && \ 106 echo "Expected: '${EXPECTVER}' :: Found: '${FOUND_VER}'" && \ 107 test "${FOUND_VER}" = "${EXPECTVER}" 108 109 110 # ---- changelog test ---- 111 FROM min AS withchangelog 112 RUN echo "No Changelog support for apk?" 113 114 115 # ---- upgrade test ---- 116 FROM test_base AS upgrade 117 ARG oldpackage 118 RUN echo "${oldpackage}" 119 COPY ${oldpackage} /tmp/old_foo.apk 120 RUN apk add --allow-untrusted /tmp/old_foo.apk 121 122 RUN test -f /tmp/preinstall-proof 123 RUN cat /tmp/preinstall-proof | grep "Install" 124 125 RUN test -f /tmp/postinstall-proof 126 RUN cat /tmp/postinstall-proof | grep "Install" 127 128 RUN test ! -f /tmp/preupgrade-proof 129 RUN test ! -f /tmp/postupgrade-proof 130 131 RUN echo modified > /etc/regular.conf 132 RUN echo modified > /etc/noreplace.conf 133 134 RUN apk add --allow-untrusted /tmp/foo.apk 135 136 RUN test -f /tmp/preupgrade-proof 137 RUN test -f /tmp/postupgrade-proof