Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f10ebf1

Browse files
committedMay 23, 2021
add files for building container and action it on a release tag
1 parent 4e0bbad commit f10ebf1

8 files changed

+164
-3
lines changed
 

‎.github/workflows/build-release.yml

+20-1
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,23 @@ jobs:
201201
run: |
202202
cd ..
203203
s3cmd put phplist-${RELEASE_VERSION}.* s3://${{ secrets.AWS_S3_VERSIONS_BUCKET }}/
204-
s3cmd put phplist3/public_html/lists/admin/images/power-phplist.png s3://${{ secrets.AWS_S3_POWERED_BUCKET }}/images/${RELEASE_VERSION}/
204+
s3cmd put phplist3/public_html/lists/admin/images/power-phplist.png s3://${{ secrets.AWS_S3_POWERED_BUCKET }}/images/${RELEASE_VERSION}/
205+
206+
- name: Set up QEMU
207+
uses: docker/setup-qemu-action@v1
208+
209+
- name: Set up Docker Buildx
210+
uses: docker/setup-buildx-action@v1
211+
212+
- name: Login to DockerHub
213+
uses: docker/login-action@v1
214+
with:
215+
username: ${{ secrets.DOCKERHUB_USERNAME }}
216+
password: ${{ secrets.DOCKERHUB_TOKEN }}
217+
218+
- name: Build and push
219+
id: docker_build
220+
uses: docker/build-push-action@v2
221+
with:
222+
push: true
223+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/phplist-dev:$RELEASE_VERSION

‎Dockerfile

+7-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@ ARG VERSION=unknown
1616
RUN echo VERSION=${VERSION}
1717

1818
RUN rm -rf /var/www/phpList3 && mkdir /var/www/phpList3
19-
RUN rm -rf /etc/phpList3 && mkdir /etc/phpList3
19+
RUN rm -rf /etc/phplist && mkdir /etc/phplist
2020

21-
COPY public_html /var/www/phpList3
21+
COPY docker/docker-apache-phplist.conf /etc/apache2/sites-available
22+
COPY docker/docker-entrypoint.sh /usr/local/bin/
23+
COPY docker/phplist-crontab /etc/cron.d/
24+
COPY docker/docker-phplist-config-live.php /etc/phplist/
25+
26+
COPY phplist3/ /var/www/phpList3
2227

2328
RUN rm -f /etc/apache2/sites-enabled/000-default.conf && \
2429
cd /var/www/ && find . -type d -name .git -print0 | xargs -0 rm -rf && \

‎docker/docker-apache-phplist.conf

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
ServerName phplist.docker
2+
<VirtualHost *:80>
3+
ServerAdmin webmaster@localhost
4+
DocumentRoot /var/www/phpList3/public_html/
5+
SetEnv ConfigFile /etc/phplist/config.php
6+
DirectoryIndex index.php
7+
php_value upload_max_filesize 50M
8+
php_value post_max_size 100M
9+
10+
<Directory /var/www/phpList3>
11+
AllowOverride All
12+
</Directory>
13+
</VirtualHost>

‎docker/docker-entrypoint-nginx.sh

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
## entry point file, needed to be able to pass ENV vars from docker-compose.yml to the containers.
4+
5+
echo Initialising phpList, Please wait
6+
7+
exec 6>&1
8+
exec > /usr/bin/phplist
9+
10+
echo '#!/bin/bash'
11+
echo -n
12+
echo 'exec 6>&1'
13+
echo 'exec > /dev/null 2>&1'
14+
printenv | sed 's/^\(.*\)$/export \1/g'
15+
echo -n
16+
echo 'exec 1>&6 6>&-'
17+
echo /usr/bin/php /var/www/phpList3/public_html/lists/admin/index.php -c /var/www/phpList3/config.php \$\*
18+
19+
exec 1>&6 6>&-
20+
chmod 755 /usr/bin/phplist
21+
22+
## wait for the DB container, but not forever
23+
UNCONNECTED=$(phplist | grep "Cannot connect")
24+
COUNT=1
25+
while [[ "$UNCONNECTED" ]] && [[ $COUNT -lt 11 ]] ; do
26+
echo Waiting for the Database to be available - $COUNT/10
27+
sleep 10;
28+
UNCONNECTED=$(phplist | grep "Cannot connect")
29+
COUNT=$(( $COUNT + 1 ))
30+
done
31+
32+
if [[ "$UNCONNECTED" ]]; then
33+
echo Failed to find a Database to connect to
34+
exit;
35+
fi
36+
37+
/usr/bin/phplist -pinitialise
38+
/usr/bin/phplist -pinitlanguages
39+
40+
echo READY
41+
echo $(phplist --version)
42+
service cron start
43+
/usr/bin/nginx -g 'daemon off;'

‎docker/docker-entrypoint.sh

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
## entry point file, needed to be able to pass ENV vars from docker-compose.yml to the containers.
4+
5+
echo Initialising phpList, Please wait
6+
7+
exec 6>&1
8+
exec > /usr/bin/phplist
9+
10+
echo '#!/bin/bash'
11+
echo -n
12+
echo 'exec 6>&1'
13+
echo 'exec > /dev/null 2>&1'
14+
printenv | sed 's/^\(.*\)$/export \1/g'
15+
echo -n
16+
echo 'exec 1>&6 6>&-'
17+
echo /usr/bin/php /var/www/phpList3/public_html/lists/admin/index.php -c /etc/phplist/config.php \$\*
18+
19+
exec 1>&6 6>&-
20+
chmod 755 /usr/bin/phplist
21+
22+
## wait for the DB container, but not forever
23+
UNCONNECTED=$(phplist | grep "Cannot connect")
24+
COUNT=1
25+
while [[ "$UNCONNECTED" ]] && [[ $COUNT -lt 11 ]] ; do
26+
echo Waiting for the Database to be available - $COUNT/10
27+
sleep 10;
28+
UNCONNECTED=$(phplist | grep "Cannot connect")
29+
COUNT=$(( $COUNT + 1 ))
30+
done
31+
32+
if [[ "$UNCONNECTED" ]]; then
33+
echo Failed to find a Database to connect to
34+
exit;
35+
fi
36+
37+
/usr/bin/phplist -pinitialise
38+
/usr/bin/phplist -pinitlanguages
39+
40+
echo READY
41+
echo $(phplist --version)
42+
service cron start
43+
/usr/sbin/apache2ctl -D FOREGROUND

‎docker/docker-phplist-config-dev.php

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
$database_host = getenv('DB_HOST');
4+
$database_name = getenv('DB_NAME');
5+
$database_user = getenv('DB_USER');
6+
$database_password = getenv('DB_PASSWORD');
7+
$mailhost = getenv('MAILHOST');
8+
define('PHPMAILERHOST', $mailhost);
9+
define('PHPMAILERPORT', 1025);
10+
define('TEST', 0);
11+
define('HASH_ALGO', 'sha256');
12+
define('UPLOADIMAGES_DIR','images');
13+
define ("MANUALLY_PROCESS_BOUNCES",0);
14+
define ("MANUALLY_PROCESS_QUEUE",0);
15+
define('CHECK_REFERRER',false);
16+
#define('VERBOSE', 1);
17+
#define('PHPMAILER_SMTP_DEBUG', 1);
18+
define('PHPMAILER_SECURE',0);
19+
define('DEVVERSION',true);
20+
21+
$developer_email = 'phplist@test-mailhost.phplist.com';

‎docker/docker-phplist-config-live.php

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
$database_host = getenv('DB_HOST');
4+
$database_name = getenv('DB_NAME');
5+
$database_user = getenv('DB_USER');
6+
$database_password = getenv('DB_PASSWORD');
7+
$mailhost = getenv('MAILHOST');
8+
define('PHPMAILERHOST', $mailhost);
9+
define('TEST', 0);
10+
define('HASH_ALGO', 'sha256');
11+
define('UPLOADIMAGES_DIR','images');
12+
define ('MANUALLY_PROCESS_BOUNCES',1);
13+
define ('MANUALLY_PROCESS_QUEUE',0);
14+
define('PHPMAILER_SECURE',0);
15+
define('CHECK_REFERRER',false);

‎docker/phplist-crontab

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*/1 * * * * phplist -pprocessqueue >> /var/log/phplist.log 2>&1
2+
0 3 * * * phplist -pprocessbounces >> /var/log/phplist-bounces.log 2>&1

0 commit comments

Comments
 (0)
Please sign in to comment.