From 0e61e8c90d8d8c65072e17995725ad525fff6c9b Mon Sep 17 00:00:00 2001 From: Austin Best Date: Tue, 14 Nov 2023 18:45:09 -0500 Subject: [PATCH] Initial commit --- .dockerignore | 4 ++ .github/renovate.json | 16 +++++ .github/workflows/docker-publish.yml | 67 +++++++++++++++++++++ Dockerfile | 88 ++++++++++++++++++++++++++++ root/app/www/public/index.php | 14 +++++ root/app/www/public/setup.php | 10 ++++ 6 files changed, 199 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/renovate.json create mode 100644 .github/workflows/docker-publish.yml create mode 100644 Dockerfile create mode 100644 root/app/www/public/index.php create mode 100644 root/app/www/public/setup.php diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5160ce4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +/Dockerfile +/LICENSE +/README.md +/.github diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..d431426 --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:base", + "docker:enableMajor", + "default:automergeDigest" + ], + "packageRules": [ + { + "matchDatasources": ["docker"], + "matchPackageNames": ["ubuntu"], + "matchUpdateTypes": ["minor", "patch", "pin", "digest"], + "automerge": true + } + ] + } diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..5f13420 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,67 @@ +name: Docker + +# This all came from github. I wrote none of it, but I did remove some bits that didn't work. + +on: + push: + branches: [ "main" ] + # Publish semver tags as releases. + tags: [ 'v*.*.*' ] + pull_request: + branches: [ "main" ] + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + + # Workaround: https://github.com/docker/build-push-action/issues/461 + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v3 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..00ea3de --- /dev/null +++ b/Dockerfile @@ -0,0 +1,88 @@ +# syntax=docker/dockerfile:1 + +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.18 + +# set version label +ARG BUILD_DATE +ARG VERSION +ARG NGINX_VERSION +LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" +LABEL maintainer="aptalca" + +# install packages +RUN \ + if [ -z ${NGINX_VERSION+x} ]; then \ + NGINX_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \ + && awk '/^P:nginx$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \ + fi && \ + apk add --no-cache \ + memcached \ + nginx==${NGINX_VERSION} \ + nginx-mod-http-brotli==${NGINX_VERSION} \ + nginx-mod-http-dav-ext==${NGINX_VERSION} \ + nginx-mod-http-echo==${NGINX_VERSION} \ + nginx-mod-http-fancyindex==${NGINX_VERSION} \ + nginx-mod-http-geoip==${NGINX_VERSION} \ + nginx-mod-http-geoip2==${NGINX_VERSION} \ + nginx-mod-http-headers-more==${NGINX_VERSION} \ + nginx-mod-http-image-filter==${NGINX_VERSION} \ + nginx-mod-http-perl==${NGINX_VERSION} \ + nginx-mod-http-redis2==${NGINX_VERSION} \ + nginx-mod-http-set-misc==${NGINX_VERSION} \ + nginx-mod-http-upload-progress==${NGINX_VERSION} \ + nginx-mod-http-xslt-filter==${NGINX_VERSION} \ + nginx-mod-mail==${NGINX_VERSION} \ + nginx-mod-rtmp==${NGINX_VERSION} \ + nginx-mod-stream==${NGINX_VERSION} \ + nginx-mod-stream-geoip==${NGINX_VERSION} \ + nginx-mod-stream-geoip2==${NGINX_VERSION} \ + nginx-vim==${NGINX_VERSION} \ + php82-bcmath \ + php82-bz2 \ + php82-dom \ + php82-exif \ + php82-ftp \ + php82-gd \ + php82-gmp \ + php82-imap \ + php82-intl \ + php82-ldap \ + php82-mysqli \ + php82-mysqlnd \ + php82-opcache \ + php82-pdo_mysql \ + php82-pdo_odbc \ + php82-pdo_pgsql \ + php82-pdo_sqlite \ + php82-pear \ + php82-pecl-apcu \ + php82-pecl-memcached \ + php82-pecl-redis \ + php82-pgsql \ + php82-posix \ + php82-soap \ + php82-sockets \ + php82-sodium \ + php82-sqlite3 \ + php82-tokenizer \ + php82-xmlreader \ + php82-xsl && \ + apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \ + php82-pecl-mcrypt && \ + echo "**** configure php-fpm to pass env vars ****" && \ + sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php82/php-fpm.d/www.conf && \ + grep -qxF 'clear_env = no' /etc/php82/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php82/php-fpm.d/www.conf && \ + echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php82/php-fpm.conf + +#ARG INSTALL_PACKAGES=docker gzip +#RUN apk add --update ${INSTALL_PACKAGES} && \ +# addgroup -g 281 unraiddocker && \ +# usermod -aG unraiddocker abc + +# add local files +COPY root/ / + +# ports and volumes +EXPOSE 80 443 + +VOLUME /config \ No newline at end of file diff --git a/root/app/www/public/index.php b/root/app/www/public/index.php new file mode 100644 index 0000000..87ee565 --- /dev/null +++ b/root/app/www/public/index.php @@ -0,0 +1,14 @@ +