├── .github └── workflows │ └── ci.yml ├── Dockerfile-alpine.template ├── Dockerfile-debian.template ├── LICENSE ├── README.md ├── apache ├── Dockerfile └── docker-entrypoint.sh ├── docker-entrypoint.sh ├── fpm-alpine ├── Dockerfile └── docker-entrypoint.sh ├── fpm ├── Dockerfile └── docker-entrypoint.sh ├── generate-stackbrew-library.sh └── update.sh /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: GitHub CI 2 | 3 | on: 4 | pull_request: 5 | push: 6 | schedule: 7 | - cron: 0 0 * * 0 8 | 9 | defaults: 10 | run: 11 | shell: 'bash -Eeuo pipefail -x {0}' 12 | 13 | jobs: 14 | generate-jobs: 15 | name: Generate Jobs 16 | runs-on: ubuntu-latest 17 | outputs: 18 | strategy: ${{ steps.generate-jobs.outputs.strategy }} 19 | steps: 20 | - uses: actions/checkout@v4 21 | - uses: docker-library/bashbrew@v0.1.13 22 | - id: generate-jobs 23 | name: Generate Jobs 24 | run: | 25 | strategy="$(GITHUB_REPOSITORY=postfixadmin "$BASHBREW_SCRIPTS/github-actions/generate.sh")" 26 | strategy="$("$BASHBREW_SCRIPTS/github-actions/munge-i386.sh" -c <<<"$strategy")" 27 | echo "strategy=$strategy" >> "$GITHUB_OUTPUT" 28 | jq . <<<"$strategy" # sanity check / debugging aid 29 | 30 | test: 31 | needs: generate-jobs 32 | strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }} 33 | name: ${{ matrix.name }} 34 | runs-on: ${{ matrix.os }} 35 | steps: 36 | - uses: actions/checkout@v3 37 | - name: Prepare Environment 38 | run: ${{ matrix.runs.prepare }} 39 | - name: Pull Dependencies 40 | run: ${{ matrix.runs.pull }} 41 | - name: Build ${{ matrix.name }} 42 | run: ${{ matrix.runs.build }} 43 | - name: History ${{ matrix.name }} 44 | run: ${{ matrix.runs.history }} 45 | - name: Test ${{ matrix.name }} 46 | run: ${{ matrix.runs.test }} 47 | - name: '"docker images"' 48 | run: ${{ matrix.runs.images }} 49 | -------------------------------------------------------------------------------- /Dockerfile-alpine.template: -------------------------------------------------------------------------------- 1 | FROM php:8.3-%%VARIANT%% 2 | LABEL maintainer="David Goodwin (@DavidGoodwin)" 3 | 4 | # docker-entrypoint.sh dependencies 5 | RUN apk add --no-cache \ 6 | bash \ 7 | su-exec 8 | 9 | # Install required PHP extensions 10 | RUN set -ex; \ 11 | \ 12 | apk add --no-cache --virtual .build-deps \ 13 | imap-dev \ 14 | krb5-dev \ 15 | postgresql-dev \ 16 | sqlite-dev \ 17 | ; \ 18 | docker-php-ext-configure \ 19 | imap --with-imap-ssl --with-kerberos \ 20 | ; \ 21 | docker-php-ext-install -j "$(nproc)" \ 22 | imap \ 23 | pdo_mysql \ 24 | pdo_pgsql \ 25 | pdo_sqlite \ 26 | pgsql \ 27 | ; \ 28 | runDeps="$( \ 29 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \ 30 | | tr ',' '\n' \ 31 | | sort -u \ 32 | | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 33 | )"; \ 34 | apk add --no-network --virtual .postfixadmin-phpexts-rundeps $runDeps; \ 35 | apk del --no-network .build-deps 36 | 37 | ARG POSTFIXADMIN_VERSION=3.3.15 38 | ARG POSTFIXADMIN_SHA512=02c4a7fb0d5b148a2f9e73e0278a47d1ee63b29a0019cf510f04d33386fc50727c0dae728eafee688a136159ba462af1931fe0658daa06671459c43668867865 39 | 40 | ENV POSTFIXADMIN_VERSION $POSTFIXADMIN_VERSION 41 | ENV POSTFIXADMIN_SHA512 $POSTFIXADMIN_SHA512 42 | 43 | RUN set -eu; \ 44 | curl -fsSL -o postfixadmin.tar.gz "https://github.com/postfixadmin/postfixadmin/archive/postfixadmin-${POSTFIXADMIN_VERSION}.tar.gz"; \ 45 | echo "$POSTFIXADMIN_SHA512 *postfixadmin.tar.gz" | sha512sum -c -; \ 46 | # upstream tarball include ./postfixadmin-postfixadmin-${POSTFIXADMIN_VERSION}/ 47 | mkdir /usr/src/postfixadmin; \ 48 | tar -xf postfixadmin.tar.gz -C /usr/src/postfixadmin --strip-components=1; \ 49 | rm postfixadmin.tar.gz; \ 50 | # Does not exist in tarball but is required 51 | mkdir -p /usr/src/postfixadmin/templates_c; \ 52 | chown -R www-data:www-data /usr/src/postfixadmin 53 | 54 | COPY docker-entrypoint.sh /usr/local/bin/ 55 | 56 | ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] 57 | CMD ["%%CMD%%"] 58 | -------------------------------------------------------------------------------- /Dockerfile-debian.template: -------------------------------------------------------------------------------- 1 | FROM php:8.3-%%VARIANT%% 2 | LABEL maintainer="David Goodwin (@DavidGoodwin)" 3 | 4 | # docker-entrypoint.sh dependencies 5 | RUN set -eux; \ 6 | apt-get update; \ 7 | apt-get install -y --no-install-recommends \ 8 | gosu \ 9 | ; \ 10 | rm -rf /var/lib/apt/lists/* 11 | 12 | # Install required PHP extensions 13 | RUN set -ex; \ 14 | \ 15 | savedAptMark="$(apt-mark showmanual)"; \ 16 | \ 17 | apt-get update; \ 18 | apt-get install -y --no-install-recommends \ 19 | libc-client2007e-dev \ 20 | libkrb5-dev \ 21 | libpq-dev \ 22 | libsqlite3-dev \ 23 | ; \ 24 | \ 25 | docker-php-ext-configure \ 26 | imap --with-imap-ssl --with-kerberos \ 27 | ; \ 28 | \ 29 | docker-php-ext-install -j "$(nproc)" \ 30 | imap \ 31 | pdo_mysql \ 32 | pdo_pgsql \ 33 | pdo_sqlite \ 34 | pgsql \ 35 | ; \ 36 | \ 37 | # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies 38 | apt-mark auto '.*' > /dev/null; \ 39 | apt-mark manual $savedAptMark; \ 40 | ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ 41 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \ 42 | | sort -u \ 43 | | xargs -r dpkg-query --search \ 44 | | cut -d: -f1 \ 45 | | sort -u \ 46 | | xargs -rt apt-mark manual; \ 47 | \ 48 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 49 | rm -rf /var/lib/apt/lists/* 50 | 51 | ARG POSTFIXADMIN_VERSION=3.3.15 52 | ARG POSTFIXADMIN_SHA512=02c4a7fb0d5b148a2f9e73e0278a47d1ee63b29a0019cf510f04d33386fc50727c0dae728eafee688a136159ba462af1931fe0658daa06671459c43668867865 53 | 54 | ENV POSTFIXADMIN_VERSION $POSTFIXADMIN_VERSION 55 | ENV POSTFIXADMIN_SHA512 $POSTFIXADMIN_SHA512 56 | ENV APACHE_DOCUMENT_ROOT /var/www/html/public 57 | 58 | RUN set -eu; sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf; \ 59 | sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf 60 | 61 | RUN set -eu; \ 62 | curl -fsSL -o postfixadmin.tar.gz "https://github.com/postfixadmin/postfixadmin/archive/postfixadmin-${POSTFIXADMIN_VERSION}.tar.gz"; \ 63 | echo "$POSTFIXADMIN_SHA512 *postfixadmin.tar.gz" | sha512sum -c -; \ 64 | # upstream tarball include ./postfixadmin-postfixadmin-${POSTFIXADMIN_VERSION}/ 65 | mkdir /usr/src/postfixadmin; \ 66 | tar -xf postfixadmin.tar.gz -C /usr/src/postfixadmin --strip-components=1; \ 67 | rm postfixadmin.tar.gz; \ 68 | # Does not exist in tarball but is required 69 | mkdir -p /usr/src/postfixadmin/templates_c; \ 70 | chown -R www-data:www-data /usr/src/postfixadmin 71 | 72 | COPY docker-entrypoint.sh /usr/local/bin/ 73 | 74 | ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] 75 | CMD ["%%CMD%%"] 76 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![GitHub CI build status badge](https://github.com/postfixadmin/docker/workflows/GitHub%20CI/badge.svg)](https://github.com/postfixadmin/docker/actions?query=workflow%3A%22GitHub+CI%22) 2 | 3 | [![amd64 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/amd64/job/postfixadmin.svg?label=amd64)](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/postfixadmin) 4 | [![arm32v5 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm32v5/job/postfixadmin.svg?label=arm32v5)](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v5/job/postfixadmin) 5 | [![arm32v6 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm32v6/job/postfixadmin.svg?label=arm32v6)](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v6/job/postfixadmin) 6 | [![arm32v7 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm32v7/job/postfixadmin.svg?label=arm32v7)](https://doi-janky.infosiftr.net/job/multiarch/job/arm32v7/job/postfixadmin) 7 | [![arm64v8 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm64v8/job/postfixadmin.svg?label=arm64v8)](https://doi-janky.infosiftr.net/job/multiarch/job/arm64v8/job/postfixadmin) 8 | [![i386 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/i386/job/postfixadmin.svg?label=i386)](https://doi-janky.infosiftr.net/job/multiarch/job/i386/job/postfixadmin) 9 | [![mips64le build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/mips64le/job/postfixadmin.svg?label=mips64le)](https://doi-janky.infosiftr.net/job/multiarch/job/mips64le/job/postfixadmin) 10 | [![ppc64le build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/ppc64le/job/postfixadmin.svg?label=ppc64le)](https://doi-janky.infosiftr.net/job/multiarch/job/ppc64le/job/postfixadmin) 11 | [![s390x build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/s390x/job/postfixadmin.svg?label=s390x)](https://doi-janky.infosiftr.net/job/multiarch/job/s390x/job/postfixadmin) 12 | 13 | # Building 14 | 15 | * Clone this repo ( `git clone https://github.com/postfixadmin/docker.git docker` ) and then run : 16 | * `docker build --pull --rm -t postfixadmin-image ` from within the created directory (where \ is replaced by apache, fpm or fpm-alpine) 17 | 18 | ## Image Variants 19 | 20 | The following variant are currently provided: 21 | 22 | ### apache 23 | 24 | This starts an Apache webserver with PHP, so you can use `postfixadmin` out of the box. 25 | 26 | ### fpm-alpine 27 | 28 | This image has a very small footprint. It is based on Alpine Linux and starts only a PHP FPM process. Use this variant if you already have a seperate webserver. 29 | 30 | If you need more tools, that are not available on Alpine Linux, use the `fpm` image instead. 31 | 32 | ### fpm 33 | 34 | This image is based on Debian and starts only a PHP FPM container. 35 | 36 | Use this variant if you already have a seperate webserver. 37 | 38 | # Running 39 | 40 | Some knowledge of Postfixadmin is assumed. 41 | 42 | Advanced users will probably want to specify a custom configuration (config.local.php file). 43 | 44 | If you're just trying out the software, there's probably no need for a config.local.php file. 45 | 46 | 47 | ## No config.local.php / no existing setup 48 | 49 | You have two options : 50 | 51 | * Use a default sqlite database, or 52 | * Use an external database (MySQL, PgSQL etc). 53 | 54 | You can configure this through the following environment variables when running the docker container. 55 | 56 | * POSTFIXADMIN\_DB\_TYPE=... - sqlite, mysqli, pgsql 57 | * POSTFIXADMIN\_DB\_NAME=.... - database name or path to database file (sqlite) 58 | * POSTFIXADMIN\_DB\_USER=... - mysqli/pgsql only (db server user name) 59 | * POSTFIXADMIN\_DB\_HOST=... - hostname for database, default is localhost. 60 | * POSTFIXADMIN\_DB\_PORT=... - port for the database (optional) 61 | * POSTFIXADMIN\_DB\_PASSWORD=... - mysqli/pgsql only (db server user password) 62 | * POSTFIXADMIN_ENCRYPT=... - database password encryption (e.g. md5crypt, SHA512-CRYPT) 63 | * POSTFIXADMIN\_SETUP\_PASSWORD=... - generated from setup.php or `php -r "echo password_hash('mysecretpassword', PASSWORD_DEFAULT);"` 64 | 65 | Note: An SQLite database is probably not recommended for production use, but is a quick and easy way to try out the software without dependencies. 66 | 67 | Note2: For details about database password encryption please refer to the [postfixadmin hashing documentation](https://github.com/postfixadmin/postfixadmin/blob/postfixadmin_3.3/DOCUMENTS/HASHING.md) 68 | 69 | You can also set the postfix host and port. 70 | 71 | * POSTFIXADMIN\_SMTP\_SERVER=... - localhost per default 72 | * POSTFIXADMIN\_SMTP\_PORT=... - 25 per default 73 | 74 | You can enable DKIM through the following enviroment variables 75 | * POSTFIXADMIN\_DKIM=... - YES/NO 76 | * POSTFIXADMIN\_DKIM\_ALL\_ADMINS=... - YES/NO 77 | 78 | ### Using Docker secrets 79 | 80 | As an alternative to passing sensitive information via environment variables, `_FILE` may be appended to some of the previously listed environment variables, causing the initialization script to load the values for those variables from files present in the container. In particular, this can be used to load passwords from Docker secrets stored in /run/secrets/ files. For example: 81 | 82 | ```bash 83 | docker run -e POSTFIXADMIN_DB_USER_FILE=/run/secrets/postfix-db-user 84 | -e POSTFIXADMIN_DB_PASSWORD_FILE=/run/secrets/postfix-db-passwd 85 | -e POSTFIXADMIN_SETUP_PASSWORD_FILE=/run/secrets/postfix-setup-passwd 86 | postfixadmin 87 | ``` 88 | 89 | All environment vars are supporting the secret's docker strategy. 90 | 91 | ### Example docker run 92 | 93 | ```bash 94 | docker run -e POSTFIXADMIN_DB_TYPE=mysqli \ 95 | -e POSTFIXADMIN_DB_HOST=whatever \ 96 | -e POSTFIXADMIN_DB_USER=user \ 97 | -e POSTFIXADMIN_DB_PASSWORD=changeme \ 98 | -e POSTFIXADMIN_DB_NAME=postfixadmin \ 99 | -e POSTFIXADMIN_SMTP_SERVER=postfix \ 100 | -e POSTFIXADMIN_SMTP_PORT=25 \ 101 | -e POSTFIXADMIN_ENCRYPT=md5crypt \ 102 | -e POSTFIXADMIN_DKIM=YES \ 103 | -e POSTFIXADMIN_DKIM_ALL_ADMINS=NO \ 104 | --name postfixadmin \ 105 | -p 8080:80 \ 106 | postfixadmin 107 | ``` 108 | 109 | 110 | ## Existing setup / with config.local.php 111 | 112 | Postfixadmin's default configuration is stored in a config.inc.php file (see https://github.com/postfixadmin/postfixadmin/blob/master/config.inc.php ). 113 | 114 | To customise, copy this file, remove everything you don't want to override, and call it **config.local.php**. 115 | 116 | 117 | ```bash 118 | docker run -v /local/path/to/config.local.php:/var/www/html/config.local.php \ 119 | --name postfixadmin \ 120 | -p 8080:80 \ 121 | postfixadmin 122 | ``` 123 | 124 | # Next Steps 125 | 126 | Once the container is running, try visiting : 127 | 128 | * http://localhost:8080/setup.php (to create admin users) 129 | * http://localhost:8080/ (to login as the domain admin you created through setup.php) 130 | 131 | 132 | # Docker Compose 133 | 134 | Try something like the below in a **docker-compose.yml** file; changing the usernames/passwords as required. 135 | 136 | Then run : `docker-compose up` 137 | 138 | ```yaml 139 | version: '3' 140 | 141 | services: 142 | db: 143 | image: mysql:5.7 144 | restart: always 145 | environment: 146 | MYSQL_ROOT_PASSWORD: notSecureChangeMe 147 | MYSQL_DATABASE: postfixadmin 148 | MYSQL_USER: postfixadmin 149 | MYSQL_PASSWORD: postfixadminPassword 150 | 151 | postfixadmin: 152 | depends_on: 153 | - db 154 | image: postfixadmin:latest 155 | ports: 156 | - "8000:80" 157 | restart: always 158 | environment: 159 | POSTFIXADMIN_DB_TYPE: mysqli 160 | POSTFIXADMIN_DB_HOST: db 161 | POSTFIXADMIN_DB_USER: postfixadmin 162 | POSTFIXADMIN_DB_NAME: postfixadmin 163 | POSTFIXADMIN_DB_PASSWORD: postfixadminPassword 164 | POSTFIXADMIN_SMTP_SERVER: postfix 165 | POSTFIXADMIN_SMTP_PORT: 25 166 | POSTFIXADMIN_ENCRYPT: md5crypt 167 | 168 | ``` 169 | -------------------------------------------------------------------------------- /apache/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.3-apache 2 | LABEL maintainer="David Goodwin (@DavidGoodwin)" 3 | 4 | # docker-entrypoint.sh dependencies 5 | RUN set -eux; \ 6 | apt-get update; \ 7 | apt-get install -y --no-install-recommends \ 8 | gosu \ 9 | ; \ 10 | rm -rf /var/lib/apt/lists/* 11 | 12 | # Install required PHP extensions 13 | RUN set -ex; \ 14 | \ 15 | savedAptMark="$(apt-mark showmanual)"; \ 16 | \ 17 | apt-get update; \ 18 | apt-get install -y --no-install-recommends \ 19 | libc-client2007e-dev \ 20 | libkrb5-dev \ 21 | libpq-dev \ 22 | libsqlite3-dev \ 23 | ; \ 24 | \ 25 | docker-php-ext-configure \ 26 | imap --with-imap-ssl --with-kerberos \ 27 | ; \ 28 | \ 29 | docker-php-ext-install -j "$(nproc)" \ 30 | imap \ 31 | pdo_mysql \ 32 | pdo_pgsql \ 33 | pdo_sqlite \ 34 | pgsql \ 35 | ; \ 36 | \ 37 | # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies 38 | apt-mark auto '.*' > /dev/null; \ 39 | apt-mark manual $savedAptMark; \ 40 | ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ 41 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \ 42 | | sort -u \ 43 | | xargs -r dpkg-query --search \ 44 | | cut -d: -f1 \ 45 | | sort -u \ 46 | | xargs -rt apt-mark manual; \ 47 | \ 48 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 49 | rm -rf /var/lib/apt/lists/* 50 | 51 | ARG POSTFIXADMIN_VERSION=3.3.15 52 | ARG POSTFIXADMIN_SHA512=02c4a7fb0d5b148a2f9e73e0278a47d1ee63b29a0019cf510f04d33386fc50727c0dae728eafee688a136159ba462af1931fe0658daa06671459c43668867865 53 | 54 | ENV POSTFIXADMIN_VERSION $POSTFIXADMIN_VERSION 55 | ENV POSTFIXADMIN_SHA512 $POSTFIXADMIN_SHA512 56 | ENV APACHE_DOCUMENT_ROOT /var/www/html/public 57 | 58 | RUN set -eu; sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf; \ 59 | sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf 60 | 61 | RUN set -eu; \ 62 | curl -fsSL -o postfixadmin.tar.gz "https://github.com/postfixadmin/postfixadmin/archive/postfixadmin-${POSTFIXADMIN_VERSION}.tar.gz"; \ 63 | echo "$POSTFIXADMIN_SHA512 *postfixadmin.tar.gz" | sha512sum -c -; \ 64 | # upstream tarball include ./postfixadmin-postfixadmin-${POSTFIXADMIN_VERSION}/ 65 | mkdir /usr/src/postfixadmin; \ 66 | tar -xf postfixadmin.tar.gz -C /usr/src/postfixadmin --strip-components=1; \ 67 | rm postfixadmin.tar.gz; \ 68 | # Does not exist in tarball but is required 69 | mkdir -p /usr/src/postfixadmin/templates_c; \ 70 | chown -R www-data:www-data /usr/src/postfixadmin 71 | 72 | COPY docker-entrypoint.sh /usr/local/bin/ 73 | 74 | ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] 75 | CMD ["apache2-foreground"] 76 | -------------------------------------------------------------------------------- /apache/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | # usage: get_env_value VAR [DEFAULT] 5 | # ie: get_env_value 'XYZ_DB_PASSWORD' 'example' 6 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of 7 | # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) 8 | function get_env_value() { 9 | local varName="${1}" 10 | local fileVarName="${varName}_FILE" 11 | local defaultValue="${2:-}" 12 | 13 | if [ "${!varName:-}" ] && [ "${!fileVarName:-}" ]; then 14 | echo >&2 "error: both ${varName} and ${fileVarName} are set (but are exclusive)" 15 | exit 1 16 | fi 17 | 18 | local value="${defaultValue}" 19 | if [ "${!varName:-}" ]; then 20 | value="${!varName}" 21 | elif [ "${!fileVarName:-}" ]; then 22 | value="$(< "${!fileVarName}")" 23 | fi 24 | 25 | echo "${value}" 26 | exit 0 27 | } 28 | 29 | # Init vars for running script 30 | POSTFIXADMIN_DB_TYPE=$(get_env_value 'POSTFIXADMIN_DB_TYPE' 'sqlite') 31 | POSTFIXADMIN_DB_HOST=$(get_env_value "POSTFIXADMIN_DB_HOST" "") 32 | POSTFIXADMIN_DB_PORT=$(get_env_value "POSTFIXADMIN_DB_PORT" "") 33 | POSTFIXADMIN_DB_USER=$(get_env_value "POSTFIXADMIN_DB_USER" "") 34 | POSTFIXADMIN_DB_PASSWORD=$(get_env_value "POSTFIXADMIN_DB_PASSWORD" "") 35 | POSTFIXADMIN_SMTP_SERVER=$(get_env_value "POSTFIXADMIN_SMTP_SERVER" "localhost") 36 | POSTFIXADMIN_SMTP_PORT=$(get_env_value "POSTFIXADMIN_SMTP_PORT" "25") 37 | POSTFIXADMIN_ENCRYPT=$(get_env_value "POSTFIXADMIN_ENCRYPT" "md5crypt") 38 | POSTFIXADMIN_DKIM=$(get_env_value "POSTFIXADMIN_DKIM" "NO") 39 | POSTFIXADMIN_DKIM_ALL_ADMINS=$(get_env_value "POSTFIXADMIN_DKIM_ALL_ADMINS" "NO") 40 | 41 | DEFAULT_SETUP_PASSWORD="changeme" 42 | POSTFIXADMIN_SETUP_PASSWORD=$(get_env_value "POSTFIXADMIN_SETUP_PASSWORD" "${DEFAULT_SETUP_PASSWORD}") 43 | 44 | if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then 45 | 46 | if [ "${POSTFIXADMIN_SETUP_PASSWORD}" = "${DEFAULT_SETUP_PASSWORD}" ]; then 47 | echo >&2 "WARNING: setup.php password not set" 48 | fi 49 | 50 | if ! [ -e index.php ] && ! [ -e scripts/postfixadmin-cli.php ]; then 51 | echo >&2 "Postfixadmin not found in $PWD - copying now..." 52 | if [ "$(ls -A)" ]; then 53 | echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!" 54 | ( set -x; ls -A; sleep 10 ) 55 | fi 56 | tar cf - --one-file-system -C /usr/src/postfixadmin . | tar xf - 57 | echo >&2 "Complete! Postfixadmin has been successfully copied to $PWD" 58 | fi 59 | 60 | case "${POSTFIXADMIN_DB_TYPE}" in 61 | sqlite) 62 | ;; 63 | mysqli) 64 | : "${POSTFIXADMIN_DB_PORT:=3306}" 65 | ;; 66 | pgsql) 67 | : "${POSTFIXADMIN_DB_PORT:=5432}" 68 | ;; 69 | *) 70 | echo >&2 "${POSTFIXADMIN_DB_TYPE} is not a supported value." 71 | exit 1 72 | ;; 73 | esac 74 | 75 | if [ "${POSTFIXADMIN_DB_TYPE}" != "sqlite" ]; then 76 | if [ -z "${POSTFIXADMIN_DB_USER}" ] || [ -z "${POSTFIXADMIN_DB_PASSWORD}" ]; then 77 | echo >&2 'Error: POSTFIXADMIN_DB_USER and POSTFIXADMIN_DB_PASSWORD must be specified. ' 78 | exit 1 79 | fi 80 | timeout 15 bash -c "until echo > /dev/tcp/${POSTFIXADMIN_DB_HOST}/${POSTFIXADMIN_DB_PORT}; do sleep 0.5; done" 81 | fi 82 | 83 | if [ "${POSTFIXADMIN_DB_TYPE}" = 'sqlite' ]; then 84 | : "${POSTFIXADMIN_DB_NAME:=/var/tmp/postfixadmin.db}" 85 | 86 | if [ ! -f "${POSTFIXADMIN_DB_NAME}" ]; then 87 | echo "Creating sqlite db" 88 | touch $POSTFIXADMIN_DB_NAME 89 | chown www-data:www-data $POSTFIXADMIN_DB_NAME 90 | chmod 0700 $POSTFIXADMIN_DB_NAME 91 | fi 92 | fi 93 | 94 | if [ ! -e config.local.php ]; then 95 | touch config.local.php 96 | echo "Write config to $PWD/config.local.php" 97 | echo "" | tee config.local.php 112 | else 113 | echo "WARNING: $PWD/config.local.php already exists." 114 | echo "Postfixadmin related environment variables have been ignored." 115 | fi 116 | 117 | if [ -f public/upgrade.php ]; then 118 | echo " ** Running database / environment upgrade.php " 119 | gosu www-data php public/upgrade.php 120 | fi 121 | fi 122 | 123 | exec "$@" 124 | -------------------------------------------------------------------------------- /docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | # usage: get_env_value VAR [DEFAULT] 5 | # ie: get_env_value 'XYZ_DB_PASSWORD' 'example' 6 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of 7 | # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) 8 | function get_env_value() { 9 | local varName="${1}" 10 | local fileVarName="${varName}_FILE" 11 | local defaultValue="${2:-}" 12 | 13 | if [ "${!varName:-}" ] && [ "${!fileVarName:-}" ]; then 14 | echo >&2 "error: both ${varName} and ${fileVarName} are set (but are exclusive)" 15 | exit 1 16 | fi 17 | 18 | local value="${defaultValue}" 19 | if [ "${!varName:-}" ]; then 20 | value="${!varName}" 21 | elif [ "${!fileVarName:-}" ]; then 22 | value="$(< "${!fileVarName}")" 23 | fi 24 | 25 | echo "${value}" 26 | exit 0 27 | } 28 | 29 | # Init vars for running script 30 | POSTFIXADMIN_DB_TYPE=$(get_env_value 'POSTFIXADMIN_DB_TYPE' 'sqlite') 31 | POSTFIXADMIN_DB_HOST=$(get_env_value "POSTFIXADMIN_DB_HOST" "") 32 | POSTFIXADMIN_DB_PORT=$(get_env_value "POSTFIXADMIN_DB_PORT" "") 33 | POSTFIXADMIN_DB_USER=$(get_env_value "POSTFIXADMIN_DB_USER" "") 34 | POSTFIXADMIN_DB_PASSWORD=$(get_env_value "POSTFIXADMIN_DB_PASSWORD" "") 35 | POSTFIXADMIN_SMTP_SERVER=$(get_env_value "POSTFIXADMIN_SMTP_SERVER" "localhost") 36 | POSTFIXADMIN_SMTP_PORT=$(get_env_value "POSTFIXADMIN_SMTP_PORT" "25") 37 | POSTFIXADMIN_ENCRYPT=$(get_env_value "POSTFIXADMIN_ENCRYPT" "md5crypt") 38 | POSTFIXADMIN_DKIM=$(get_env_value "POSTFIXADMIN_DKIM" "NO") 39 | POSTFIXADMIN_DKIM_ALL_ADMINS=$(get_env_value "POSTFIXADMIN_DKIM_ALL_ADMINS" "NO") 40 | 41 | DEFAULT_SETUP_PASSWORD="changeme" 42 | POSTFIXADMIN_SETUP_PASSWORD=$(get_env_value "POSTFIXADMIN_SETUP_PASSWORD" "${DEFAULT_SETUP_PASSWORD}") 43 | 44 | if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then 45 | 46 | if [ "${POSTFIXADMIN_SETUP_PASSWORD}" = "${DEFAULT_SETUP_PASSWORD}" ]; then 47 | echo >&2 "WARNING: setup.php password not set" 48 | fi 49 | 50 | if ! [ -e index.php ] && ! [ -e scripts/postfixadmin-cli.php ]; then 51 | echo >&2 "Postfixadmin not found in $PWD - copying now..." 52 | if [ "$(ls -A)" ]; then 53 | echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!" 54 | ( set -x; ls -A; sleep 10 ) 55 | fi 56 | tar cf - --one-file-system -C /usr/src/postfixadmin . | tar xf - 57 | echo >&2 "Complete! Postfixadmin has been successfully copied to $PWD" 58 | fi 59 | 60 | case "${POSTFIXADMIN_DB_TYPE}" in 61 | sqlite) 62 | ;; 63 | mysqli) 64 | : "${POSTFIXADMIN_DB_PORT:=3306}" 65 | ;; 66 | pgsql) 67 | : "${POSTFIXADMIN_DB_PORT:=5432}" 68 | ;; 69 | *) 70 | echo >&2 "${POSTFIXADMIN_DB_TYPE} is not a supported value." 71 | exit 1 72 | ;; 73 | esac 74 | 75 | if [ "${POSTFIXADMIN_DB_TYPE}" != "sqlite" ]; then 76 | if [ -z "${POSTFIXADMIN_DB_USER}" ] || [ -z "${POSTFIXADMIN_DB_PASSWORD}" ]; then 77 | echo >&2 'Error: POSTFIXADMIN_DB_USER and POSTFIXADMIN_DB_PASSWORD must be specified. ' 78 | exit 1 79 | fi 80 | timeout 15 bash -c "until echo > /dev/tcp/${POSTFIXADMIN_DB_HOST}/${POSTFIXADMIN_DB_PORT}; do sleep 0.5; done" 81 | fi 82 | 83 | if [ "${POSTFIXADMIN_DB_TYPE}" = 'sqlite' ]; then 84 | : "${POSTFIXADMIN_DB_NAME:=/var/tmp/postfixadmin.db}" 85 | 86 | if [ ! -f "${POSTFIXADMIN_DB_NAME}" ]; then 87 | echo "Creating sqlite db" 88 | touch $POSTFIXADMIN_DB_NAME 89 | chown www-data:www-data $POSTFIXADMIN_DB_NAME 90 | chmod 0700 $POSTFIXADMIN_DB_NAME 91 | fi 92 | fi 93 | 94 | if [ ! -e config.local.php ]; then 95 | touch config.local.php 96 | echo "Write config to $PWD/config.local.php" 97 | echo "" | tee config.local.php 112 | else 113 | echo "WARNING: $PWD/config.local.php already exists." 114 | echo "Postfixadmin related environment variables have been ignored." 115 | fi 116 | 117 | if [ -f public/upgrade.php ]; then 118 | echo " ** Running database / environment upgrade.php " 119 | gosu www-data php public/upgrade.php 120 | fi 121 | fi 122 | 123 | exec "$@" 124 | -------------------------------------------------------------------------------- /fpm-alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.3-fpm-alpine 2 | LABEL maintainer="David Goodwin (@DavidGoodwin)" 3 | 4 | # docker-entrypoint.sh dependencies 5 | RUN apk add --no-cache \ 6 | bash \ 7 | su-exec 8 | 9 | # Install required PHP extensions 10 | RUN set -ex; \ 11 | \ 12 | apk add --no-cache --virtual .build-deps \ 13 | imap-dev \ 14 | krb5-dev \ 15 | postgresql-dev \ 16 | sqlite-dev \ 17 | ; \ 18 | docker-php-ext-configure \ 19 | imap --with-imap-ssl --with-kerberos \ 20 | ; \ 21 | docker-php-ext-install -j "$(nproc)" \ 22 | imap \ 23 | pdo_mysql \ 24 | pdo_pgsql \ 25 | pdo_sqlite \ 26 | pgsql \ 27 | ; \ 28 | runDeps="$( \ 29 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \ 30 | | tr ',' '\n' \ 31 | | sort -u \ 32 | | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 33 | )"; \ 34 | apk add --no-network --virtual .postfixadmin-phpexts-rundeps $runDeps; \ 35 | apk del --no-network .build-deps 36 | 37 | ARG POSTFIXADMIN_VERSION=3.3.15 38 | ARG POSTFIXADMIN_SHA512=02c4a7fb0d5b148a2f9e73e0278a47d1ee63b29a0019cf510f04d33386fc50727c0dae728eafee688a136159ba462af1931fe0658daa06671459c43668867865 39 | 40 | ENV POSTFIXADMIN_VERSION $POSTFIXADMIN_VERSION 41 | ENV POSTFIXADMIN_SHA512 $POSTFIXADMIN_SHA512 42 | 43 | RUN set -eu; \ 44 | curl -fsSL -o postfixadmin.tar.gz "https://github.com/postfixadmin/postfixadmin/archive/postfixadmin-${POSTFIXADMIN_VERSION}.tar.gz"; \ 45 | echo "$POSTFIXADMIN_SHA512 *postfixadmin.tar.gz" | sha512sum -c -; \ 46 | # upstream tarball include ./postfixadmin-postfixadmin-${POSTFIXADMIN_VERSION}/ 47 | mkdir /usr/src/postfixadmin; \ 48 | tar -xf postfixadmin.tar.gz -C /usr/src/postfixadmin --strip-components=1; \ 49 | rm postfixadmin.tar.gz; \ 50 | # Does not exist in tarball but is required 51 | mkdir -p /usr/src/postfixadmin/templates_c; \ 52 | chown -R www-data:www-data /usr/src/postfixadmin 53 | 54 | COPY docker-entrypoint.sh /usr/local/bin/ 55 | 56 | ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] 57 | CMD ["php-fpm"] 58 | -------------------------------------------------------------------------------- /fpm-alpine/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | # usage: get_env_value VAR [DEFAULT] 5 | # ie: get_env_value 'XYZ_DB_PASSWORD' 'example' 6 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of 7 | # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) 8 | function get_env_value() { 9 | local varName="${1}" 10 | local fileVarName="${varName}_FILE" 11 | local defaultValue="${2:-}" 12 | 13 | if [ "${!varName:-}" ] && [ "${!fileVarName:-}" ]; then 14 | echo >&2 "error: both ${varName} and ${fileVarName} are set (but are exclusive)" 15 | exit 1 16 | fi 17 | 18 | local value="${defaultValue}" 19 | if [ "${!varName:-}" ]; then 20 | value="${!varName}" 21 | elif [ "${!fileVarName:-}" ]; then 22 | value="$(< "${!fileVarName}")" 23 | fi 24 | 25 | echo "${value}" 26 | exit 0 27 | } 28 | 29 | # Init vars for running script 30 | POSTFIXADMIN_DB_TYPE=$(get_env_value 'POSTFIXADMIN_DB_TYPE' 'sqlite') 31 | POSTFIXADMIN_DB_HOST=$(get_env_value "POSTFIXADMIN_DB_HOST" "") 32 | POSTFIXADMIN_DB_PORT=$(get_env_value "POSTFIXADMIN_DB_PORT" "") 33 | POSTFIXADMIN_DB_USER=$(get_env_value "POSTFIXADMIN_DB_USER" "") 34 | POSTFIXADMIN_DB_PASSWORD=$(get_env_value "POSTFIXADMIN_DB_PASSWORD" "") 35 | POSTFIXADMIN_SMTP_SERVER=$(get_env_value "POSTFIXADMIN_SMTP_SERVER" "localhost") 36 | POSTFIXADMIN_SMTP_PORT=$(get_env_value "POSTFIXADMIN_SMTP_PORT" "25") 37 | POSTFIXADMIN_ENCRYPT=$(get_env_value "POSTFIXADMIN_ENCRYPT" "md5crypt") 38 | POSTFIXADMIN_DKIM=$(get_env_value "POSTFIXADMIN_DKIM" "NO") 39 | POSTFIXADMIN_DKIM_ALL_ADMINS=$(get_env_value "POSTFIXADMIN_DKIM_ALL_ADMINS" "NO") 40 | 41 | DEFAULT_SETUP_PASSWORD="changeme" 42 | POSTFIXADMIN_SETUP_PASSWORD=$(get_env_value "POSTFIXADMIN_SETUP_PASSWORD" "${DEFAULT_SETUP_PASSWORD}") 43 | 44 | if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then 45 | 46 | if [ "${POSTFIXADMIN_SETUP_PASSWORD}" = "${DEFAULT_SETUP_PASSWORD}" ]; then 47 | echo >&2 "WARNING: setup.php password not set" 48 | fi 49 | 50 | if ! [ -e index.php ] && ! [ -e scripts/postfixadmin-cli.php ]; then 51 | echo >&2 "Postfixadmin not found in $PWD - copying now..." 52 | if [ "$(ls -A)" ]; then 53 | echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!" 54 | ( set -x; ls -A; sleep 10 ) 55 | fi 56 | tar cf - --one-file-system -C /usr/src/postfixadmin . | tar xf - 57 | echo >&2 "Complete! Postfixadmin has been successfully copied to $PWD" 58 | fi 59 | 60 | case "${POSTFIXADMIN_DB_TYPE}" in 61 | sqlite) 62 | ;; 63 | mysqli) 64 | : "${POSTFIXADMIN_DB_PORT:=3306}" 65 | ;; 66 | pgsql) 67 | : "${POSTFIXADMIN_DB_PORT:=5432}" 68 | ;; 69 | *) 70 | echo >&2 "${POSTFIXADMIN_DB_TYPE} is not a supported value." 71 | exit 1 72 | ;; 73 | esac 74 | 75 | if [ "${POSTFIXADMIN_DB_TYPE}" != "sqlite" ]; then 76 | if [ -z "${POSTFIXADMIN_DB_USER}" ] || [ -z "${POSTFIXADMIN_DB_PASSWORD}" ]; then 77 | echo >&2 'Error: POSTFIXADMIN_DB_USER and POSTFIXADMIN_DB_PASSWORD must be specified. ' 78 | exit 1 79 | fi 80 | timeout 15 bash -c "until echo > /dev/tcp/${POSTFIXADMIN_DB_HOST}/${POSTFIXADMIN_DB_PORT}; do sleep 0.5; done" 81 | fi 82 | 83 | if [ "${POSTFIXADMIN_DB_TYPE}" = 'sqlite' ]; then 84 | : "${POSTFIXADMIN_DB_NAME:=/var/tmp/postfixadmin.db}" 85 | 86 | if [ ! -f "${POSTFIXADMIN_DB_NAME}" ]; then 87 | echo "Creating sqlite db" 88 | touch $POSTFIXADMIN_DB_NAME 89 | chown www-data:www-data $POSTFIXADMIN_DB_NAME 90 | chmod 0700 $POSTFIXADMIN_DB_NAME 91 | fi 92 | fi 93 | 94 | if [ ! -e config.local.php ]; then 95 | touch config.local.php 96 | echo "Write config to $PWD/config.local.php" 97 | echo "" | tee config.local.php 112 | else 113 | echo "WARNING: $PWD/config.local.php already exists." 114 | echo "Postfixadmin related environment variables have been ignored." 115 | fi 116 | 117 | if [ -f public/upgrade.php ]; then 118 | echo " ** Running database / environment upgrade.php " 119 | su-exec www-data php public/upgrade.php 120 | fi 121 | fi 122 | 123 | exec "$@" 124 | -------------------------------------------------------------------------------- /fpm/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.3-fpm 2 | LABEL maintainer="David Goodwin (@DavidGoodwin)" 3 | 4 | # docker-entrypoint.sh dependencies 5 | RUN set -eux; \ 6 | apt-get update; \ 7 | apt-get install -y --no-install-recommends \ 8 | gosu \ 9 | ; \ 10 | rm -rf /var/lib/apt/lists/* 11 | 12 | # Install required PHP extensions 13 | RUN set -ex; \ 14 | \ 15 | savedAptMark="$(apt-mark showmanual)"; \ 16 | \ 17 | apt-get update; \ 18 | apt-get install -y --no-install-recommends \ 19 | libc-client2007e-dev \ 20 | libkrb5-dev \ 21 | libpq-dev \ 22 | libsqlite3-dev \ 23 | ; \ 24 | \ 25 | docker-php-ext-configure \ 26 | imap --with-imap-ssl --with-kerberos \ 27 | ; \ 28 | \ 29 | docker-php-ext-install -j "$(nproc)" \ 30 | imap \ 31 | pdo_mysql \ 32 | pdo_pgsql \ 33 | pdo_sqlite \ 34 | pgsql \ 35 | ; \ 36 | \ 37 | # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies 38 | apt-mark auto '.*' > /dev/null; \ 39 | apt-mark manual $savedAptMark; \ 40 | ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ 41 | | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \ 42 | | sort -u \ 43 | | xargs -r dpkg-query --search \ 44 | | cut -d: -f1 \ 45 | | sort -u \ 46 | | xargs -rt apt-mark manual; \ 47 | \ 48 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 49 | rm -rf /var/lib/apt/lists/* 50 | 51 | ARG POSTFIXADMIN_VERSION=3.3.15 52 | ARG POSTFIXADMIN_SHA512=02c4a7fb0d5b148a2f9e73e0278a47d1ee63b29a0019cf510f04d33386fc50727c0dae728eafee688a136159ba462af1931fe0658daa06671459c43668867865 53 | 54 | ENV POSTFIXADMIN_VERSION $POSTFIXADMIN_VERSION 55 | ENV POSTFIXADMIN_SHA512 $POSTFIXADMIN_SHA512 56 | 57 | 58 | RUN set -eu; \ 59 | curl -fsSL -o postfixadmin.tar.gz "https://github.com/postfixadmin/postfixadmin/archive/postfixadmin-${POSTFIXADMIN_VERSION}.tar.gz"; \ 60 | echo "$POSTFIXADMIN_SHA512 *postfixadmin.tar.gz" | sha512sum -c -; \ 61 | # upstream tarball include ./postfixadmin-postfixadmin-${POSTFIXADMIN_VERSION}/ 62 | mkdir /usr/src/postfixadmin; \ 63 | tar -xf postfixadmin.tar.gz -C /usr/src/postfixadmin --strip-components=1; \ 64 | rm postfixadmin.tar.gz; \ 65 | # Does not exist in tarball but is required 66 | mkdir -p /usr/src/postfixadmin/templates_c; \ 67 | chown -R www-data:www-data /usr/src/postfixadmin 68 | 69 | COPY docker-entrypoint.sh /usr/local/bin/ 70 | 71 | ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] 72 | CMD ["php-fpm"] 73 | -------------------------------------------------------------------------------- /fpm/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | # usage: get_env_value VAR [DEFAULT] 5 | # ie: get_env_value 'XYZ_DB_PASSWORD' 'example' 6 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of 7 | # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) 8 | function get_env_value() { 9 | local varName="${1}" 10 | local fileVarName="${varName}_FILE" 11 | local defaultValue="${2:-}" 12 | 13 | if [ "${!varName:-}" ] && [ "${!fileVarName:-}" ]; then 14 | echo >&2 "error: both ${varName} and ${fileVarName} are set (but are exclusive)" 15 | exit 1 16 | fi 17 | 18 | local value="${defaultValue}" 19 | if [ "${!varName:-}" ]; then 20 | value="${!varName}" 21 | elif [ "${!fileVarName:-}" ]; then 22 | value="$(< "${!fileVarName}")" 23 | fi 24 | 25 | echo "${value}" 26 | exit 0 27 | } 28 | 29 | # Init vars for running script 30 | POSTFIXADMIN_DB_TYPE=$(get_env_value 'POSTFIXADMIN_DB_TYPE' 'sqlite') 31 | POSTFIXADMIN_DB_HOST=$(get_env_value "POSTFIXADMIN_DB_HOST" "") 32 | POSTFIXADMIN_DB_PORT=$(get_env_value "POSTFIXADMIN_DB_PORT" "") 33 | POSTFIXADMIN_DB_USER=$(get_env_value "POSTFIXADMIN_DB_USER" "") 34 | POSTFIXADMIN_DB_PASSWORD=$(get_env_value "POSTFIXADMIN_DB_PASSWORD" "") 35 | POSTFIXADMIN_SMTP_SERVER=$(get_env_value "POSTFIXADMIN_SMTP_SERVER" "localhost") 36 | POSTFIXADMIN_SMTP_PORT=$(get_env_value "POSTFIXADMIN_SMTP_PORT" "25") 37 | POSTFIXADMIN_ENCRYPT=$(get_env_value "POSTFIXADMIN_ENCRYPT" "md5crypt") 38 | POSTFIXADMIN_DKIM=$(get_env_value "POSTFIXADMIN_DKIM" "NO") 39 | POSTFIXADMIN_DKIM_ALL_ADMINS=$(get_env_value "POSTFIXADMIN_DKIM_ALL_ADMINS" "NO") 40 | 41 | DEFAULT_SETUP_PASSWORD="changeme" 42 | POSTFIXADMIN_SETUP_PASSWORD=$(get_env_value "POSTFIXADMIN_SETUP_PASSWORD" "${DEFAULT_SETUP_PASSWORD}") 43 | 44 | if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then 45 | 46 | if [ "${POSTFIXADMIN_SETUP_PASSWORD}" = "${DEFAULT_SETUP_PASSWORD}" ]; then 47 | echo >&2 "WARNING: setup.php password not set" 48 | fi 49 | 50 | if ! [ -e index.php ] && ! [ -e scripts/postfixadmin-cli.php ]; then 51 | echo >&2 "Postfixadmin not found in $PWD - copying now..." 52 | if [ "$(ls -A)" ]; then 53 | echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!" 54 | ( set -x; ls -A; sleep 10 ) 55 | fi 56 | tar cf - --one-file-system -C /usr/src/postfixadmin . | tar xf - 57 | echo >&2 "Complete! Postfixadmin has been successfully copied to $PWD" 58 | fi 59 | 60 | case "${POSTFIXADMIN_DB_TYPE}" in 61 | sqlite) 62 | ;; 63 | mysqli) 64 | : "${POSTFIXADMIN_DB_PORT:=3306}" 65 | ;; 66 | pgsql) 67 | : "${POSTFIXADMIN_DB_PORT:=5432}" 68 | ;; 69 | *) 70 | echo >&2 "${POSTFIXADMIN_DB_TYPE} is not a supported value." 71 | exit 1 72 | ;; 73 | esac 74 | 75 | if [ "${POSTFIXADMIN_DB_TYPE}" != "sqlite" ]; then 76 | if [ -z "${POSTFIXADMIN_DB_USER}" ] || [ -z "${POSTFIXADMIN_DB_PASSWORD}" ]; then 77 | echo >&2 'Error: POSTFIXADMIN_DB_USER and POSTFIXADMIN_DB_PASSWORD must be specified. ' 78 | exit 1 79 | fi 80 | timeout 15 bash -c "until echo > /dev/tcp/${POSTFIXADMIN_DB_HOST}/${POSTFIXADMIN_DB_PORT}; do sleep 0.5; done" 81 | fi 82 | 83 | if [ "${POSTFIXADMIN_DB_TYPE}" = 'sqlite' ]; then 84 | : "${POSTFIXADMIN_DB_NAME:=/var/tmp/postfixadmin.db}" 85 | 86 | if [ ! -f "${POSTFIXADMIN_DB_NAME}" ]; then 87 | echo "Creating sqlite db" 88 | touch $POSTFIXADMIN_DB_NAME 89 | chown www-data:www-data $POSTFIXADMIN_DB_NAME 90 | chmod 0700 $POSTFIXADMIN_DB_NAME 91 | fi 92 | fi 93 | 94 | if [ ! -e config.local.php ]; then 95 | touch config.local.php 96 | echo "Write config to $PWD/config.local.php" 97 | echo "" | tee config.local.php 112 | else 113 | echo "WARNING: $PWD/config.local.php already exists." 114 | echo "Postfixadmin related environment variables have been ignored." 115 | fi 116 | 117 | if [ -f public/upgrade.php ]; then 118 | echo " ** Running database / environment upgrade.php " 119 | gosu www-data php public/upgrade.php 120 | fi 121 | fi 122 | 123 | exec "$@" 124 | -------------------------------------------------------------------------------- /generate-stackbrew-library.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | self="$(basename "$BASH_SOURCE")" 5 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 6 | defaultVariant='apache' 7 | 8 | # Get the most recent commit which modified any of "$@". 9 | fileCommit() { 10 | git log -1 --format='format:%H' HEAD -- "$@" 11 | } 12 | 13 | # Get the most recent commit which modified "$1/Dockerfile" or any file that 14 | # the Dockerfile copies into the rootfs (with COPY). 15 | dockerfileCommit() { 16 | local dir="$1"; shift 17 | ( 18 | cd "$dir"; 19 | fileCommit Dockerfile \ 20 | $(git show HEAD:./Dockerfile | awk ' 21 | toupper($1) == "COPY" { 22 | for (i = 2; i < NF; i++) 23 | print $i; 24 | } 25 | ') 26 | ) 27 | } 28 | 29 | getArches() { 30 | local repo="$1"; shift 31 | local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/' 32 | 33 | eval "declare -g -A parentRepoToArches=( $( 34 | find -name 'Dockerfile' -exec awk ' 35 | toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|microsoft\/[^:]+)(:|$)/ { 36 | print "'"$officialImagesUrl"'" $2 37 | } 38 | ' '{}' + \ 39 | | sort -u \ 40 | | xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"' 41 | ) )" 42 | } 43 | getArches 'postfixadmin' 44 | 45 | # Header. 46 | cat <<-EOH 47 | # This file is generated via https://github.com/postfixadmin/docker/blob/$(fileCommit "$self")/$self 48 | Maintainers: David Goodwin (@DavidGoodwin) 49 | GitRepo: https://github.com/postfixadmin/docker.git 50 | EOH 51 | 52 | # prints "$2$1$3$1...$N" 53 | join() { 54 | local sep="$1"; shift 55 | local out; printf -v out "${sep//%/%%}%s" "$@" 56 | echo "${out#$sep}" 57 | } 58 | 59 | SEARCHFOR="Upgrade available - the latest version is " 60 | latest=$(curl -fsSL http://postfixadmin.sourceforge.net/update-check.php | grep -iF "$SEARCHFOR" | sed -E "s@${SEARCHFOR}([0-9.]+)@\1@") 61 | 62 | variants=( */ ) 63 | variants=( "${variants[@]%/}" ) 64 | 65 | for variant in "${variants[@]}"; do 66 | commit="$(dockerfileCommit "$variant")" 67 | fullversion="$(git show "$commit":"$variant/Dockerfile" | grep -iF "ARG POSTFIXADMIN_VERSION" | sed -E "s@ARG POSTFIXADMIN_VERSION=([0-9.]+)@\1@")" 68 | 69 | versionAliases=( "$fullversion" "${fullversion%.*}" "${fullversion%.*.*}" ) 70 | if [ "$fullversion" = "$latest" ]; then 71 | versionAliases+=( "latest" ) 72 | fi 73 | 74 | variantAliases=( "${versionAliases[@]/%/-$variant}" ) 75 | variantAliases=( "${variantAliases[@]//latest-}" ) 76 | 77 | if [ "$variant" = "$defaultVariant" ]; then 78 | variantAliases+=( "${versionAliases[@]}" ) 79 | fi 80 | 81 | variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$variant/Dockerfile")" 82 | variantArches="${parentRepoToArches[$variantParent]}" 83 | 84 | cat <<-EOE 85 | 86 | Tags: $(join ', ' "${variantAliases[@]}") 87 | Architectures: $(join ', ' $variantArches) 88 | Directory: $variant 89 | GitCommit: $commit 90 | EOE 91 | done 92 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | declare -A cmd=( 5 | [apache]='apache2-foreground' 6 | [fpm]='php-fpm' 7 | [fpm-alpine]='php-fpm' 8 | ) 9 | 10 | declare -A base=( 11 | [apache]='debian' 12 | [fpm]='debian' 13 | [fpm-alpine]='alpine' 14 | ) 15 | 16 | for variant in apache fpm fpm-alpine; do 17 | dir="$variant" 18 | template="Dockerfile-${base[$variant]}.template" 19 | mkdir -p "$dir" 20 | cp -a "docker-entrypoint.sh" "$dir/docker-entrypoint.sh" 21 | sed -r \ 22 | -e 's!%%VARIANT%%!'"$variant"'!g' \ 23 | -e 's!%%CMD%%!'"${cmd[$variant]}"'!g' \ 24 | "Dockerfile-${base[$variant]}.template" > "$dir/Dockerfile" 25 | if [ $variant != "apache" ]; then 26 | sed -i -e '/APACHE_DOCUMENT_ROOT/d' "$dir/Dockerfile" 27 | fi 28 | sed -i -e 's/gosu/su-exec/g' "fpm-alpine/docker-entrypoint.sh" 29 | done 30 | --------------------------------------------------------------------------------