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

View File

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

View File

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

View File

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

View File

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