-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create 8.2/beta, v8.2.87 - Set latest-beta, etc. tags to 8.2/beta - A…
…rchive 8.0 folders and workflows
- Loading branch information
1 parent
c749ae6
commit 3ea0d1d
Showing
52 changed files
with
1,134 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
name: Build 8.2 Beta | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 8.2/beta/** | ||
- .github/workflows/build-8.2-beta.yml | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
- | ||
name: Set up dynamic build ARGs | ||
id: getargs | ||
run: echo "version=$(cat ./8.2/beta/VERSION)" >> $GITHUB_OUTPUT | ||
- | ||
name: Set up Docker metadata for Alpine | ||
id: meta-alpine | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ github.repository }} | ||
ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=raw,latest-alpine-beta | ||
type=raw,8.2-alpine-beta | ||
labels: | | ||
org.opencontainers.image.vendor=The Goofball - goofball222@gmail.com | ||
org.opencontainers.image.title=UniFi Controller | ||
org.opencontainers.image.description=UniFi Controller | ||
org.opencontainers.image.version=${{ steps.getargs.outputs.version }}-Alpine | ||
- | ||
name: Set up Docker metadata for Debian | ||
id: meta-debian | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ github.repository }} | ||
ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=raw,latest-debian-beta | ||
type=raw,8.2-debian-beta | ||
labels: | | ||
org.opencontainers.image.vendor=The Goofball - goofball222@gmail.com | ||
org.opencontainers.image.title=UniFi Controller | ||
org.opencontainers.image.description=UniFi Controller | ||
org.opencontainers.image.version=${{ steps.getargs.outputs.version }}-Debian | ||
- | ||
name: Set up Docker metadata for Ubuntu | ||
id: meta-ubuntu | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ github.repository }} | ||
ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=raw,latest-beta | ||
type=raw,latest-ubuntu-beta | ||
type=raw,8.2-beta | ||
type=raw,8.2-ubuntu-beta | ||
labels: | | ||
org.opencontainers.image.vendor=The Goofball - goofball222@gmail.com | ||
org.opencontainers.image.title=UniFi Controller | ||
org.opencontainers.image.description=UniFi Controller | ||
org.opencontainers.image.version=${{ steps.getargs.outputs.version }}-Ubuntu | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Login to GHCR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Build and push Alpine Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./8.2/beta | ||
file: ./8.2/beta/Dockerfile.alpine | ||
platforms: linux/amd64,linux/arm64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta-alpine.outputs.tags }} | ||
labels: ${{ steps.meta-alpine.outputs.labels }} | ||
build-args: VERSION=${{ steps.getargs.outputs.version }} | ||
- | ||
name: Build and push Debian Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./8.2/beta | ||
file: ./8.2/beta/Dockerfile.debian | ||
platforms: linux/amd64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta-debian.outputs.tags }} | ||
labels: ${{ steps.meta-debian.outputs.labels }} | ||
build-args: VERSION=${{ steps.getargs.outputs.version }} | ||
- | ||
name: Build and push Ubuntu Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./8.2/beta | ||
file: ./8.2/beta/Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta-ubuntu.outputs.tags }} | ||
labels: ${{ steps.meta-ubuntu.outputs.labels }} | ||
build-args: VERSION=${{ steps.getargs.outputs.version }} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
8.2.87-54321d7713 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
#!/usr/bin/env bash | ||
|
||
# docker-entrypoint.sh script for UniFi Docker container | ||
# License: Apache-2.0 | ||
# Github: https://github.com/goofball222/unifi | ||
SCRIPT_VERSION="1.1.3" | ||
# Last updated date: 2024-03-01 | ||
|
||
set -Eeuo pipefail | ||
|
||
if [ "${DEBUG}" == 'true' ]; then | ||
set -x | ||
LOGSTDOUT="true" | ||
fi | ||
|
||
. /usr/local/bin/entrypoint-functions.sh | ||
|
||
BASEDIR="/usr/lib/unifi" | ||
CERTDIR=${BASEDIR}/cert | ||
DATADIR=${BASEDIR}/data | ||
LOGDIR=${BASEDIR}/logs | ||
RUNDIR=${BASEDIR}/run | ||
|
||
LOGSTDOUT=${LOGSTDOUT:-"false"} | ||
READENV=${READENV:-"true"} | ||
|
||
f_log "INFO - Entrypoint script version ${SCRIPT_VERSION}" | ||
f_log "INFO - Entrypoint functions version ${ENTRYPOINT_FUNCTIONS_VERSION}" | ||
|
||
[ ! -z "${JVM_MAX_HEAP_SIZE}" ] && JVM_EXTRA_OPTS="${JVM_EXTRA_OPTS} -Xmx${JVM_MAX_HEAP_SIZE}" | ||
[ ! -z "${JVM_INIT_HEAP_SIZE}" ] && JVM_EXTRA_OPTS="${JVM_EXTRA_OPTS} -Xms${JVM_INIT_HEAP_SIZE}" | ||
|
||
JVM_EXTRA_OPTS="${JVM_EXTRA_OPTS} -Dunifi.datadir=${DATADIR} -Dunifi.logdir=${LOGDIR} -Dunifi.rundir=${RUNDIR}" | ||
|
||
JVM_OPTS="${JVM_EXTRA_OPTS} -Djava.awt.headless=true -Dfile.encoding=UTF-8 --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.time=ALL-UNNAMED --add-opens java.base/sun.security.util=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport=ALL-UNNAMED" | ||
|
||
cd ${BASEDIR} | ||
|
||
f_exit_handler() { | ||
f_log "INFO - Exit signal received, commencing shutdown" | ||
exec /usr/bin/java ${JVM_OPTS} -jar ${BASEDIR}/lib/ace.jar stop & | ||
for i in `seq 0 25`; do | ||
[ -z "$(pgrep -f ${BASEDIR}/lib/ace.jar)" ] && break | ||
# graceful shutdown | ||
[ $i -gt 0 ] && [ -d ${RUNDIR} ] && touch ${RUNDIR}/server.stop || true | ||
# savage shutdown | ||
[ $i -gt 19 ] && pkill -f ${BASEDIR}/lib/ace.jar || true | ||
sleep 1 | ||
done | ||
f_log "INFO - Shutdown complete. Nothing more to see here. Have a nice day!" | ||
f_log "INFO - Exit with status code ${?}" | ||
exit ${?}; | ||
} | ||
|
||
f_idle_handler() { | ||
if [ "$LOGSTDOUT" = 'true' ]; then | ||
while true | ||
do | ||
tail -f /dev/null & wait ${!} | ||
done | ||
else | ||
while true | ||
do | ||
tail -F -n0 ${LOGDIR}/server.log & wait ${!} | ||
done | ||
fi | ||
} | ||
|
||
trap 'kill ${!}; f_exit_handler' SIGHUP SIGINT SIGQUIT SIGTERM | ||
|
||
if [ "$(id -u)" = '0' ]; then | ||
f_log "INFO - Entrypoint running with UID 0 (root)" | ||
if [[ "${@}" == 'unifi' ]]; then | ||
f_giduid | ||
f_mongo | ||
f_sysprop | ||
f_ssl | ||
f_bindpriv | ||
f_chown | ||
if [ "${RUNAS_UID0}" == 'true' ]; then | ||
f_log "INFO - RUNAS_UID0=true - running UniFi processes as UID 0 (root)" | ||
f_log "WARN - ======================================================================" | ||
f_log "WARN - *** Running as UID 0 (root) is an insecure configuration ***" | ||
f_log "WARN - ======================================================================" | ||
f_log "EXEC - /usr/bin/java ${JVM_OPTS} -jar ${BASEDIR}/lib/ace.jar start" | ||
exec /usr/bin/java ${JVM_OPTS} -jar ${BASEDIR}/lib/ace.jar start & | ||
f_idle_handler | ||
else | ||
if [ -x "/sbin/su-exec" ]; then | ||
f_log "INFO - Use su-exec to drop privileges and start Java/UniFi as GID=${PGID}, UID=${PUID}" | ||
f_log "EXEC - su-exec unifi:unifi /usr/bin/java ${JVM_OPTS} -jar ${BASEDIR}/lib/ace.jar start" | ||
exec su-exec unifi:unifi /usr/bin/java ${JVM_OPTS} -jar ${BASEDIR}/lib/ace.jar start & | ||
f_idle_handler | ||
elif [ -x "/usr/sbin/gosu" ]; then | ||
f_log "INFO - Use gosu to drop privileges and start Java/UniFi as GID=${PGID}, UID=${PUID}" | ||
f_log "EXEC - gosu unifi:unifi /usr/bin/java ${JVM_OPTS} -jar ${BASEDIR}/lib/ace.jar start" | ||
exec gosu unifi:unifi /usr/bin/java ${JVM_OPTS} -jar ${BASEDIR}/lib/ace.jar start & | ||
f_idle_handler | ||
else | ||
f_log "ERROR - su-exec/gosu NOT FOUND. Run state is invalid. Exiting." | ||
exit 1; | ||
fi | ||
fi | ||
else | ||
f_log "EXEC - ${@} as UID 0 (root)" | ||
exec "${@}" | ||
fi | ||
else | ||
f_log "WARN - Container/entrypoint not started as UID 0 (root)" | ||
f_log "WARN - Unable to change permissions or set custom GID/UID if configured" | ||
f_log "WARN - Process will be spawned with GID=$(id -g), UID=$(id -u)" | ||
f_log "WARN - Depending on permissions requested command may not work" | ||
if [[ "${@}" == 'unifi' ]]; then | ||
f_mongo | ||
f_sysprop | ||
f_ssl | ||
f_log "EXEC - /usr/bin/java ${JVM_OPTS} -jar ${BASEDIR}/lib/ace.jar start" | ||
exec /usr/bin/java ${JVM_OPTS} -jar ${BASEDIR}/lib/ace.jar start & | ||
f_idle_handler | ||
else | ||
f_log "EXEC - ${@}" | ||
exec "${@}" | ||
fi | ||
fi | ||
|
||
# Script should never make it here, but just in case exit with a generic error code if it does | ||
exit 1; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
FROM debian:bullseye-slim | ||
|
||
ARG BUILD_DATE | ||
ARG VCS_REF | ||
ARG VERSION | ||
|
||
LABEL \ | ||
org.opencontainers.image.vendor="The Goofball - goofball222@gmail.com" \ | ||
org.opencontainers.image.url="https://github.com/goofball222/unifi" \ | ||
org.opencontainers.image.title="UniFi Controller" \ | ||
org.opencontainers.image.description="UniFi Controller" \ | ||
org.opencontainers.image.version=${VERSION}-Debian \ | ||
org.opencontainers.image.source="https://github.com/goofball222/unifi" \ | ||
org.opencontainers.image.revision=${VCS_REF} \ | ||
org.opencontainers.image.created=${BUILD_DATE} \ | ||
org.opencontainers.image.licenses="Apache-2.0" | ||
|
||
ENV \ | ||
BIND_PRIV=false \ | ||
DEBIAN_FRONTEND=noninteractive \ | ||
DEBUG=false \ | ||
JVM_EXTRA_OPTS= \ | ||
JVM_INIT_HEAP_SIZE= \ | ||
JVM_MAX_HEAP_SIZE=1024M \ | ||
PGID=999 \ | ||
PUID=999 \ | ||
RUN_CHOWN=true \ | ||
RUNAS_UID0=false | ||
|
||
WORKDIR /usr/lib/unifi | ||
|
||
COPY root / | ||
|
||
RUN set -x \ | ||
&& groupadd -r unifi -g $PGID \ | ||
&& useradd --no-log-init -r -u $PUID -g $PGID unifi \ | ||
&& mkdir -p /usr/share/man/man1 \ | ||
&& apt-get -qqy update \ | ||
&& apt-get -qqy install apt-utils \ | ||
&& apt-get -qqy --no-install-recommends install \ | ||
dirmngr gnupg2 > /dev/null \ | ||
&& apt-get -qqy update \ | ||
&& apt-get -qqy --no-install-recommends install \ | ||
binutils curl gosu \ | ||
libcap2 libcap2-bin procps > /dev/null \ | ||
&& apt-get -qqy --no-install-recommends install \ | ||
ca-certificates-java > /dev/null \ | ||
&& apt-get -qqy --no-install-recommends install \ | ||
openjdk-17-jre-headless > /dev/null \ | ||
&& curl -fsSL https://www.mongodb.org/static/pgp/server-4.0.asc | \ | ||
apt-key add - \ | ||
&& echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.0 main" \ | ||
> /etc/apt/sources.list.d/mongodb-org-4.0.list \ | ||
&& apt-get -qqy update \ | ||
&& apt-get -qqy --no-install-recommends install \ | ||
mongodb-org-server > /dev/null \ | ||
&& curl -sSL https://dl.ui.com/unifi/${VERSION}/unifi_sysvinit_all.deb -o /tmp/unifi-${VERSION}.deb \ | ||
&& apt-get -qqy purge \ | ||
apt-utils dirmngr gnupg2 > /dev/null \ | ||
&& apt-get -qqy autoremove --purge > /dev/null \ | ||
&& apt-get -qqy clean autoclean > /dev/null \ | ||
&& dpkg --force-all -i /tmp/unifi-${VERSION}.deb \ | ||
&& rm -rf data logs run \ | ||
&& bash -c 'mkdir -p {data,logs,run,cert}' \ | ||
&& chown -R unifi:unifi /usr/lib/unifi \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/log/* | ||
|
||
EXPOSE 3478/udp 6789/tcp 8080/tcp 8443/tcp 8843/tcp 8880/tcp 10001/udp | ||
|
||
VOLUME ["/usr/lib/unifi/cert", "/usr/lib/unifi/data", "/usr/lib/unifi/logs"] | ||
|
||
HEALTHCHECK --start-period=2m CMD /usr/local/bin/docker-healthcheck.sh | ||
|
||
ENTRYPOINT ["docker-entrypoint.sh"] | ||
|
||
CMD ["unifi"] |
Oops, something went wrong.