Merge pull request #54 from CompPhy/master

Make nginx port configurable through ENV variable.
This commit is contained in:
Antony Messerli 2024-01-19 01:08:43 -06:00 committed by GitHub
commit 9403f991e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 10 additions and 7 deletions

View File

@ -14,6 +14,7 @@ RUN \
bash \
busybox \
curl \
envsubst \
git \
jq \
nghttp2-dev \
@ -46,6 +47,7 @@ RUN \
rm -rf /tmp/*
ENV TFTPD_OPTS=''
ENV NGINX_PORT='80'
EXPOSE 3000

View File

@ -57,9 +57,10 @@ The following snippets are examples of starting up the container.
docker run -d \
--name=netbootxyz \
-e MENU_VERSION=2.0.59 `# optional` \
-e NGINX_PORT=80 `# optional` \
-p 3000:3000 `# sets webapp port` \
-p 69:69/udp `# sets tftp port` \
-p 8080:80 `# optional` \
-p 8080:80 `# optional, destination should match ${NGINX_PORT} variable above.` \
-v /local/path/to/config:/config `# optional` \
-v /local/path/to/assets:/assets `# optional` \
--restart unless-stopped \
@ -139,7 +140,6 @@ INTERFACESv4="eth0"
You'll also need a `/etc/dhcp/dhcpd.conf` looking something like this:
```shell
option arch code 93 = unsigned integer 16;

View File

@ -6,11 +6,12 @@ services:
container_name: netbootxyz
environment:
- MENU_VERSION=2.0.47 # optional
- NGINX_PORT=80 # optional
volumes:
- /path/to/config:/config # optional
- /path/to/assets:/assets # optional
ports:
- 3000:3000
- 69:69/udp
- 8080:80 #optional
- 8080:80 # optional, destination should match ${NGINX_PORT} variable above.
restart: unless-stopped

View File

@ -1,5 +1,5 @@
server {
listen 80;
listen ${NGINX_PORT};
location / {
root /assets;
autoindex on;

View File

@ -13,8 +13,8 @@ mkdir -p \
[[ ! -f /config/nginx/nginx.conf ]] && \
cp /defaults/nginx.conf /config/nginx/nginx.conf
[[ ! -f /config/nginx/site-confs/default ]] && \
cp /defaults/default /config/nginx/site-confs/default
envsubst < /defaults/default > /config/nginx/site-confs/default
# Ownership
chown -R nbxyz:nbxyz /assets
chown -R nbxyz:nbxyz /var/lib/nginx
@ -27,7 +27,7 @@ mkdir -p \
# download menus if not found
if [[ ! -f /config/menus/remote/menu.ipxe ]]; then
if [[ -z ${MENU_VERSION+x} ]]; then \
if [[ -z ${MENU_VERSION+x} ]]; then \
MENU_VERSION=$(curl -sL "https://api.github.com/repos/netbootxyz/netboot.xyz/releases/latest" | jq -r '.tag_name')
fi
echo "[netbootxyz-init] Downloading netboot.xyz at ${MENU_VERSION}"