Skip to content

Commit

Permalink
php 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kwatson committed Dec 15, 2022
1 parent bf5dc00 commit 3bb6351
Show file tree
Hide file tree
Showing 10 changed files with 183 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: Build Image
name: PHP 7.4

on:
schedule:
- cron: '15 22 * * 2'
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

env:
# The default repo env will be 'ComputeStacks'; uppercase is not allowed.
Expand Down Expand Up @@ -46,12 +43,10 @@ jobs:
id: build-and-push
uses: docker/build-push-action@v3
with:
context: .
context: php7.4/
push: ${{ github.event_name != 'pull_request' }}
tags: |
cmptstks/whmcs:php7.4-litespeed
cmptstks/whmcs:latest
ghcr.io/${{ env.GH_REPO }}:php7.4-litespeed
ghcr.io/${{ env.GH_REPO }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
54 changes: 54 additions & 0 deletions .github/workflows/php81.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: PHP 8.1

on:
schedule:
- cron: '15 22 * * 2'
workflow_dispatch:

env:
# The default repo env will be 'ComputeStacks'; uppercase is not allowed.
GH_REPO: computestacks/cs-docker-whmcs

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

- name: Log into Github Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Log into DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
id: build-and-push
uses: docker/build-push-action@v3
with:
context: php8.1/
push: ${{ github.event_name != 'pull_request' }}
tags: |
cmptstks/whmcs:php8.1-litespeed
cmptstks/whmcs:latest
ghcr.io/${{ env.GH_REPO }}:php8.1-litespeed
ghcr.io/${{ env.GH_REPO }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# ComputeStacks WHMCS Container

**PHP 7.4 and OpenLitespeed**

[![Build Image](https://github.com/ComputeStacks/cs-docker-whmcs/actions/workflows/build-image.yml/badge.svg)](https://github.com/ComputeStacks/cs-docker-whmcs/actions/workflows/build-image.yml)

```bash

docker run -d --rm --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD="sUper3R4nd0m" mariadb:10.3
Expand All @@ -17,7 +13,7 @@ docker run --rm -it \
-e DB_NAME="whmcs" \
-p 3000:80 \
-p 7080:7080 \
cmptstks/whmcs:php7.4-litespeed /sbin/my_init -- bash -l
cmptstks/whmcs:php8.1-litespeed /sbin/my_init -- bash -l
```

## Submitting Issues
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions Dockerfile → php7.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ FROM ghcr.io/computestacks/cs-docker-php:7.4-litespeed

LABEL maintainer="https://computestacks.com"
LABEL org.opencontainers.image.authors="https://computestacks.com"
LABEL org.opencontainers.image.source="https://github.com/ComputeStacks/cs-docker-whmcs"
LABEL org.opencontainers.image.url="https://github.com/ComputeStacks/cs-docker-whmcs"
LABEL org.opencontainers.image.source="https://github.com/ComputeStacks/cs-docker-whmcs/tree/main/php7.4"
LABEL org.opencontainers.image.url="https://github.com/ComputeStacks/cs-docker-whmcs/tree/main/php7.4"
LABEL org.opencontainers.image.title="WHMCS with OpenLiteSpeed"

COPY 51-whmcs.sh /etc/my_init.d/
COPY root/vhosts /usr/src/lsws/conf/vhosts/
COPY whmcs_v851_full.zip /usr/src/whmcs.zip
ADD https://f.cscdn.cc/file/cstackscdn/packages/whmcs/whmcs_v861_full.zip /usr/src/whmcs.zip

RUN set -ex; \
unzip -d /usr/src/ /usr/src/whmcs.zip \
Expand Down
File renamed without changes.
31 changes: 31 additions & 0 deletions php8.1/51-whmcs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
set -euo pipefail

wait_for_db() {
counter=0
echo >&2 "Connecting to database at $DB_HOST"
while ! mysql -h $DB_HOST -P ${DB_PORT:-3306} -u $DB_USER -p$DB_PASSWORD -e "USE mysql;" >/dev/null; do
counter=$((counter+1))
if [ $counter == 30 ]; then
echo >&2 "Error: Couldn't connect to database."
exit 1
fi
echo >&2 "Trying to connect to database at $DB_HOST. Attempt $counter..."
sleep 5
done
}

setup_db() {
echo >&2 "Creating the database..."
mysql -h $DB_HOST -P ${DB_PORT:-3306} -u $DB_USER -p$DB_PASSWORD --skip-column-names -e "CREATE DATABASE IF NOT EXISTS $DB_NAME;"
}

if [ ! -d /var/www/html/whmcs ]; then
echo >&2 "No whmcs installation found in volume - copying default files..."
mv /usr/src/whmcs /var/www/html/
chown -R www-data:www-data /var/www/html/
echo >&2 "Complete! Sample files have been successfully copied to /var/www/html/whmcs"

wait_for_db
setup_db
fi
37 changes: 37 additions & 0 deletions php8.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# docker run --rm -it -e LS_ADMIN_PW=changeme -p 3000:80 -p 7080:7080 cmptstks/whmcs:php7.4-litespeed /sbin/my_init -- bash -l
FROM ghcr.io/computestacks/cs-docker-php:8.1-litespeed

LABEL maintainer="https://computestacks.com"
LABEL org.opencontainers.image.authors="https://computestacks.com"
LABEL org.opencontainers.image.source="https://github.com/ComputeStacks/cs-docker-whmcs/tree/main/php8.1"
LABEL org.opencontainers.image.url="https://github.com/ComputeStacks/cs-docker-whmcs/tree/main/php8.1"
LABEL org.opencontainers.image.title="WHMCS with OpenLiteSpeed"

COPY 51-whmcs.sh /etc/my_init.d/
COPY root/vhosts /usr/src/lsws/conf/vhosts/
ADD https://f.cscdn.cc/file/cstackscdn/packages/whmcs/whmcs_v861_full.zip /usr/src/whmcs.zip

RUN set -ex; \
unzip -d /usr/src/ /usr/src/whmcs.zip \
&& mv /usr/src/whmcs /usr/src/whmcs-public \
&& mkdir /usr/src/whmcs \
&& mv /usr/src/whmcs-public /usr/src/whmcs/ \
&& echo "#*/5 * * * * www-data /usr/local/lsws/lsphp81/bin/php -q /var/www/html/whmcs/whmcs-public/crons/cron.php" >> /usr/src/default/crontab \
&& echo "#*/5 * * * * www-data /usr/local/lsws/lsphp81/bin/php -q /var/www/html/whmcs/whmcs-public/crons/cron.php do --TicketEscalations" >> /usr/src/default/crontab \
&& mkdir /usr/src/whmcs/whmcs-updates \
&& mkdir /usr/src/whmcs/whmcs-private \
&& mkdir /usr/src/whmcs/log \
&& chmod +x /etc/my_init.d/51-whmcs.sh \
; \
sed -i 's/ map Default/ map WHMCS/g' /usr/src/lsws/conf/httpd_config.conf; \
echo '\n\
virtualhost WHMCS { \n\
vhRoot /var/www/html/whmcs/whmcs-public \n\
configFile conf/vhosts/WHMCS/vhconf.conf \n\
allowSymbolLink 1 \n\
enableScript 1 \n\
restrained 1 \n\
smartKeepAlive 1 \n\
user 1001 \n\
group 1001 \n\
}' >> /usr/src/lsws/conf/httpd_config.conf && chown lsadm: -R /usr/src/lsws/conf/vhosts/
54 changes: 54 additions & 0 deletions php8.1/root/vhosts/WHMCS/vhconf.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
docRoot /var/www/html/whmcs/whmcs-public
enableGzip 1

errorlog /var/www/html/whmcs/log/error.log {
useServer 0
logLevel INFO
rollingSize 10M
keepDays 15
}

accesslog /var/www/html/whmcs/log/access.log {
useServer 0
logFormat %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\
rollingSize 10M
keepDays 15
}


index {
useServer 0
indexFiles index.php
}

context / {
allowBrowse 1
enableExpires 1

rewrite {

}
addDefaultCharset off

phpIniOverride {

}
}

context /vendor {
allowBrowse 0

rewrite {

}
addDefaultCharset off

phpIniOverride {

}
}

rewrite {
enable 1
autoLoadHtaccess 1
}
3 changes: 0 additions & 3 deletions whmcs_v851_full.zip

This file was deleted.

0 comments on commit 3bb6351

Please sign in to comment.