Skip to content

Commit

Permalink
Merge pull request #5 from thelamer/master
Browse files Browse the repository at this point in the history
Full Local webapp stack
  • Loading branch information
CHBMB authored Dec 14, 2019
2 parents 3ce31be + 3a7c5d8 commit 9b26d53
Show file tree
Hide file tree
Showing 14 changed files with 298 additions and 70 deletions.
46 changes: 31 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,42 @@ FROM lsiobase/alpine:3.10
# set version label
ARG BUILD_DATE
ARG VERSION
ARG WEBAPP_VERSION
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="thelamer"

# build args
ARG DOWNURL="https://boot.netboot.xyz/ipxe"

RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
nodejs-npm && \
echo "**** install runtime packages ****" && \
apk add --no-cache \
curl \
jq \
nginx \
nodejs \
tftp-hpa && \
echo "**** download netboot payloads ****" && \
wget -O \
/config/netboot.xyz.kpxe \
${DOWNURL}/netboot.xyz.kpxe && \
wget -O \
/config/netboot.xyz.efi \
${DOWNURL}/netboot.xyz.efi && \
echo "**** Permissions ****" && \
chown -R abc:abc \
/config
echo "**** install WebApp ****" && \
if [ -z ${WEBAPP_VERSION+x} ]; then \
WEBAPP_VERSION=$(curl -sX GET "https://api.github.com/repos/netbootxyz/webapp/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
curl -o \
/tmp/webapp.tar.gz -L \
"https://github.com/netbootxyz/webapp/archive/${WEBAPP_VERSION}.tar.gz" && \
tar xf \
/tmp/webapp.tar.gz -C \
/app/ --strip-components=1 && \
npm config set unsafe-perm true && \
npm install --prefix /app && \
echo "**** cleanup ****" && \
apk del --purge \
build-dependencies && \
rm -rf \
/tmp/*

# copy local files
COPY root/ /

# add local files
COPY /root /
# app runs on port 3000
EXPOSE 3000
46 changes: 31 additions & 15 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,42 @@ FROM lsiobase/alpine:arm64v8-3.10
# set version label
ARG BUILD_DATE
ARG VERSION
ARG WEBAPP_VERSION
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="thelamer"

# build args
ARG DOWNURL="https://boot.netboot.xyz/ipxe"

RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
nodejs-npm && \
echo "**** install runtime packages ****" && \
apk add --no-cache \
curl \
jq \
nginx \
nodejs \
tftp-hpa && \
echo "**** download netboot payloads ****" && \
wget -O \
/config/netboot.xyz.kpxe \
${DOWNURL}/netboot.xyz.kpxe && \
wget -O \
/config/netboot.xyz.efi \
${DOWNURL}/netboot.xyz.efi && \
echo "**** Permissions ****" && \
chown -R abc:abc \
/config
echo "**** install WebApp ****" && \
if [ -z ${WEBAPP_VERSION+x} ]; then \
WEBAPP_VERSION=$(curl -sX GET "https://api.github.com/repos/netbootxyz/webapp/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
curl -o \
/tmp/webapp.tar.gz -L \
"https://github.com/netbootxyz/webapp/archive/${WEBAPP_VERSION}.tar.gz" && \
tar xf \
/tmp/webapp.tar.gz -C \
/app/ --strip-components=1 && \
npm config set unsafe-perm true && \
npm install --prefix /app && \
echo "**** cleanup ****" && \
apk del --purge \
build-dependencies && \
rm -rf \
/tmp/*

# copy local files
COPY root/ /

# add local files
COPY /root /
# app runs on port 3000
EXPOSE 3000
46 changes: 31 additions & 15 deletions Dockerfile.armhf
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,42 @@ FROM lsiobase/alpine:arm32v7-3.10
# set version label
ARG BUILD_DATE
ARG VERSION
ARG WEBAPP_VERSION
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="thelamer"

# build args
ARG DOWNURL="https://boot.netboot.xyz/ipxe"

RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
nodejs-npm && \
echo "**** install runtime packages ****" && \
apk add --no-cache \
curl \
jq \
nginx \
nodejs \
tftp-hpa && \
echo "**** download netboot payloads ****" && \
wget -O \
/config/netboot.xyz.kpxe \
${DOWNURL}/netboot.xyz.kpxe && \
wget -O \
/config/netboot.xyz.efi \
${DOWNURL}/netboot.xyz.efi && \
echo "**** Permissions ****" && \
chown -R abc:abc \
/config
echo "**** install WebApp ****" && \
if [ -z ${WEBAPP_VERSION+x} ]; then \
WEBAPP_VERSION=$(curl -sX GET "https://api.github.com/repos/netbootxyz/webapp/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
curl -o \
/tmp/webapp.tar.gz -L \
"https://github.com/netbootxyz/webapp/archive/${WEBAPP_VERSION}.tar.gz" && \
tar xf \
/tmp/webapp.tar.gz -C \
/app/ --strip-components=1 && \
npm config set unsafe-perm true && \
npm install --prefix /app && \
echo "**** cleanup ****" && \
apk del --purge \
build-dependencies && \
rm -rf \
/tmp/*

# copy local files
COPY root/ /

# add local files
COPY /root /
# app runs on port 3000
EXPOSE 3000
42 changes: 26 additions & 16 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ pipeline {
GITHUB_TOKEN=credentials('498b4638-2d02-4ce5-832d-8a57d01d97ab')
GITLAB_TOKEN=credentials('b6f0f1dd-6952-4cf6-95d1-9c06380283f0')
GITLAB_NAMESPACE=credentials('gitlab-namespace-id')
EXT_GIT_BRANCH = 'master'
EXT_USER = 'netbootxyz'
EXT_REPO = 'webapp'
CONTAINER_NAME = 'netbootxyz'
BUILD_VERSION_ARG = 'NETBOOTXYZ_SHA'
BUILD_VERSION_ARG = 'WEBAPP_VERSION'
LS_USER = 'linuxserver'
LS_REPO = 'docker-netbootxyz'
DOCKERHUB_IMAGE = 'linuxserver/netbootxyz'
Expand All @@ -26,10 +29,10 @@ pipeline {
DIST_IMAGE = 'alpine'
MULTIARCH='true'
CI='true'
CI_WEB='false'
CI_PORT='69'
CI_WEB='true'
CI_PORT='3000'
CI_SSL='false'
CI_DELAY='60'
CI_DELAY='120'
CI_DOCKERENV='TZ=US/Pacific'
CI_AUTH='user:password'
CI_WEBPATH=''
Expand Down Expand Up @@ -98,16 +101,23 @@ pipeline {
/* ########################
External Release Tagging
######################## */
// If this is a custom command to determine version use that command
stage("Set tag custom bash"){
steps{
script{
env.EXT_RELEASE = sh(
script: ''' curl -sL https://boot.netboot.xyz/ipxe/netboot.xyz-sha256-checksums.txt | grep 'netboot.xyz.kpxe' | cut -c1-8 ''',
returnStdout: true).trim()
env.RELEASE_LINK = 'custom_command'
}
}
// If this is a stable github release use the latest endpoint from github to determine the ext tag
stage("Set ENV github_stable"){
steps{
script{
env.EXT_RELEASE = sh(
script: '''curl -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq -r '. | .tag_name' ''',
returnStdout: true).trim()
}
}
}
// If this is a stable or devel github release generate the link for the build message
stage("Set ENV github_link"){
steps{
script{
env.RELEASE_LINK = 'https://github.com/' + env.EXT_USER + '/' + env.EXT_REPO + '/releases/tag/' + env.EXT_RELEASE
}
}
}
// Sanitize the release tag and strip illegal docker or github characters
stage("Sanitize tag"){
Expand Down Expand Up @@ -671,11 +681,11 @@ pipeline {
"tagger": {"name": "LinuxServer Jenkins","email": "[email protected]","date": "'${GITHUB_DATE}'"}}' '''
echo "Pushing New release for Tag"
sh '''#! /bin/bash
echo "Updating to ${EXT_RELEASE_CLEAN}" > releasebody.json
curl -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq '. |.body' | sed 's:^.\\(.*\\).$:\\1:' > releasebody.json
echo '{"tag_name":"'${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}'",\
"target_commitish": "master",\
"name": "'${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}'",\
"body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n**Remote Changes:**\\n\\n' > start
"body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n**'${EXT_REPO}' Changes:**\\n\\n' > start
printf '","draft": false,"prerelease": false}' >> releasebody.json
paste -d'\\0' start releasebody.json > releasebody.json.done
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done'''
Expand Down
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ The architectures supported by this image are:
| arm64 | arm64v8-latest |
| armhf | arm32v7-latest |

## Version Tags

This image provides various versions that are available via tags. `latest` tag usually provides the latest stable version. Others are considered under development and caution must be exercised when using them.

| Tag | Description |
| :----: | --- |
| latest | Web application for full self hosting |
| tftp | TFTP server only with NETBOOT.XYZ boot files |

## Usage

Expand All @@ -64,7 +72,14 @@ Here are some example snippets to help you get started creating a container.
```
docker create \
--name=netbootxyz \
-e PUID=1000 \
-e PGID=1000 \
-e MENU_VERSION=1.9.9 `#optional` \
-p 3000:3000 \
-p 69:69/udp \
-p 8080:80 `#optional` \
-v /path/to/config:/config \
-v /path/to/assets:/assets `#optional` \
--restart unless-stopped \
linuxserver/netbootxyz
```
Expand All @@ -81,8 +96,17 @@ services:
netbootxyz:
image: linuxserver/netbootxyz
container_name: netbootxyz
environment:
- PUID=1000
- PGID=1000
- MENU_VERSION=1.9.9 #optional
volumes:
- /path/to/config:/config
- /path/to/assets:/assets #optional
ports:
- 3000:3000
- 69:69/udp
- 8080:80 #optional
restart: unless-stopped
```

Expand All @@ -92,7 +116,14 @@ Container images are configured using parameters passed at runtime (such as thos

| Parameter | Function |
| :----: | --- |
| `-p 3000` | Web configuration interface. |
| `-p 69/udp` | TFTP Port. |
| `-p 80` | NGINX server for hosting assets. |
| `-e PUID=1000` | for UserID - see below for explanation |
| `-e PGID=1000` | for GroupID - see below for explanation |
| `-e MENU_VERSION=1.9.9` | Specify a specific version of boot files you want to use from NETBOOT.XYZ (unset pulls latest) |
| `-v /config` | Storage for boot menu files and web application config |
| `-v /assets` | Storage for NETBOOT.XYZ bootable assets (live CDs and other files) |

## Environment variables from files (Docker secrets)

Expand All @@ -106,6 +137,19 @@ As an example:

Will set the environment variable `PASSWORD` based on the contents of the `/run/secrets/mysecretpassword` file.

## User / Group Identifiers

When using volumes (`-v` flags) permissions issues can arise between the host OS and the container, we avoid this issue by allowing you to specify the user `PUID` and group `PGID`.

Ensure any volume directories on the host are owned by the same user you specify and any permissions issues will vanish like magic.

In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as below:

```
$ id username
uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup)
```


 
## Application Setup
Expand Down Expand Up @@ -246,4 +290,6 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64

## Versions

* **13.12.19:** - Swapping latest tag over to webapp stack for management.
* **10.12.19:** - Adding tftp branch to provide tftp only option to latest users.
* **22.10.19:** - Initial release.
14 changes: 8 additions & 6 deletions jenkins-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

# jenkins variables
project_name: docker-netbootxyz
external_type: na
custom_version_command: "curl -sL https://boot.netboot.xyz/ipxe/netboot.xyz-sha256-checksums.txt | grep 'netboot.xyz.kpxe' | cut -c1-8"
external_type: github_stable
release_type: stable
release_tag: latest
ls_branch: master
repo_vars:
- EXT_GIT_BRANCH = 'master'
- EXT_USER = 'netbootxyz'
- EXT_REPO = 'webapp'
- CONTAINER_NAME = 'netbootxyz'
- BUILD_VERSION_ARG = 'NETBOOTXYZ_SHA'
- BUILD_VERSION_ARG = 'WEBAPP_VERSION'
- LS_USER = 'linuxserver'
- LS_REPO = 'docker-netbootxyz'
- DOCKERHUB_IMAGE = 'linuxserver/netbootxyz'
Expand All @@ -18,10 +20,10 @@ repo_vars:
- DIST_IMAGE = 'alpine'
- MULTIARCH='true'
- CI='true'
- CI_WEB='false'
- CI_PORT='69'
- CI_WEB='true'
- CI_PORT='3000'
- CI_SSL='false'
- CI_DELAY='60'
- CI_DELAY='120'
- CI_DOCKERENV='TZ=US/Pacific'
- CI_AUTH='user:password'
- CI_WEBPATH=''
Loading

0 comments on commit 9b26d53

Please sign in to comment.