Skip to content

Commit f8bc594

Browse files
committed
improve docker build: init data and htpasswd
1 parent e42c4a1 commit f8bc594

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

Dockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM php:7.2-apache
22
MAINTAINER alb-TEC engineering <[email protected]>
33

44
# prepare for pdf creation
5-
RUN apt-get update && apt-get install -y texlive-full
5+
RUN apt-get update && apt-get install -y texlive-full
66

77
# overwrite entrypoint
88
COPY docker-php-entrypoint /usr/local/bin/
@@ -18,3 +18,12 @@ RUN ln -s /etc/apache2/sites-available/*.conf /etc/apache2/sites-enabled/
1818
COPY easycom.tgz /var/www/html
1919
WORKDIR /var/www/html
2020
RUN tar xfz easycom.tgz
21+
22+
ENV HTUSER=admin
23+
ENV HTPASS=admin
24+
25+
VOLUME /var/www/html/easycom-phpbackend/_data
26+
27+
ENTRYPOINT ["docker-php-entrypoint"]
28+
EXPOSE 80
29+
CMD ["apache2-foreground"]

docker-php-entrypoint

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# init easycom:
55
################################################
66

7+
echo "Prepare storage if not set"
78
(
89
cd /var/www/html/easycom-phpbackend/
910

@@ -20,6 +21,11 @@
2021
chown www-data _data -R
2122
)
2223

24+
echo "Set password from ENV"
25+
(
26+
htpasswd -cb /var/www/html/.htpasswd $HTUSER $HTPASS
27+
)
28+
2329
################################################
2430
# copy of original docker image:
2531
################################################

run-dev/.htaccess

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
AuthType Basic
2+
AuthName "easycom"
3+
AuthUserFile .htpasswd
4+
Require valid-user
5+
16
RewriteEngine on
27
RewriteRule ^data/(.*)$ easycom-phpbackend/data/$1 [L,QSA]
38
RewriteRule ^action/(.*)$ easycom-phpbackend/action/$1 [L,QSA]

0 commit comments

Comments
 (0)