File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -38,10 +38,10 @@ or better yet, at:
3838- myapp.local/phpinfo.php
3939- myapp.local/adminer.php
4040
41- ** If you wish to change the hostname from myapp .local to something else, you can do **
41+ To build with your a different hostname.local address, do this:
4242
4343```
44- APP_URL=something.local docker-compose up -d
44+ docker-compose build --build-arg HOST_UID=$(id -u) --build-arg APP_HOSTNAME=your_hostname
4545```
4646
4747## File Paths
@@ -77,10 +77,11 @@ Example 2: to set a specific UID `--build-arg HOST_UID=1001`
7777
7878Web Servers:
7979- ` WEB ` =** httpd** | nginx
80+ - ` APP_HOSTNAME ` =** myapp** | _ string_
8081
8182Database Management System:
8283- ` DB ` =** mariadb** | mysql
83- - ` DB_VERSION ` =** latest** | num
84+ - ` DB_VERSION ` =** latest** | _ num _
8485
8586PHP
8687- ` PHP_VERSION ` =** 7** | 7.4 | 7.3 | 7.2 | 7.1 | 7.0 | 5.6
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ services:
88 volumes :
99 - ./app/web/:/var/www/html/
1010 web_server :
11- hostname : ${APP_URL:-myapp.local}
1211 build :
1312 context : ' ./docker/web/'
1413 depends_on :
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ FROM $WEB:latest
44RUN apt-get update -y
55RUN apt-get install -y --no-install-recommends avahi-daemon libnss-mdns
66
7+ ARG APP_HOSTNAME="myapp.local"
8+ RUN echo $APP_HOSTNAME | sed 's/.local//g' > /etc/app_hostname
9+
710# Copy apache config
811COPY httpd/vhost.conf /usr/local/apache2/conf/vhost.conf
912RUN echo "Include /usr/local/apache2/conf/vhost.conf" \
@@ -13,7 +16,8 @@ RUN echo "Include /usr/local/apache2/conf/vhost.conf" \
1316COPY nginx/default.conf /etc/nginx/conf.d/default.conf
1417
1518# setup avahi
16- RUN printf "[server]\n enable-dbus=no\n " >> /etc/avahi/avahi-daemon.conf
19+ RUN printf "[server]\n enable-dbus=no\n host-name=$(cat /etc/app_hostname) \ n " >> /etc/avahi/avahi-daemon.conf
1720
1821# run avahi and the web server
19- CMD avahi-daemon --daemonize --no-drop-root; httpd -DFOREGROUND || nginx -g "daemon off;"
22+ CMD avahi-daemon --daemonize --no-drop-root; \
23+ httpd -DFOREGROUND || nginx -g "daemon off;"
You can’t perform that action at this time.
0 commit comments