Skip to content

Commit

Permalink
feat(NodeJS): Adds support for multiple versions of NodeJS
Browse files Browse the repository at this point in the history
- Changes NodeJS setup to use build arguments for changing the version.
- Expands Docker image builds to include tags for specific NodeJS versions.
- Changes the GitHub Actions workflows to use a NodeJS version matrix.
- Updates the README with additional image tags for NodeJS versions and details about NodeJS support.
  • Loading branch information
timnolte committed Jan 20, 2024
1 parent 78c19db commit 9ed3d3b
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 10 deletions.
77 changes: 74 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
env:
OLS_VERSION: 1.7.19
PHP_STABLE_VERSION: '8.3.2'
NODE_STABLE_VERSION: '20'
REGISTRY: ghcr.io

jobs:
Expand All @@ -22,6 +23,10 @@ jobs:
- '8.1.27'
- '8.2.15'
- '8.3.2'
NODE_VERSION:
- '16'
- '18'
- '20'

steps:
- name: Checkout
Expand Down Expand Up @@ -63,7 +68,9 @@ jobs:
# https://github.com/marketplace/actions/build-and-push-docker-images
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
if: matrix.PHP_VERSION != env.PHP_STABLE_VERSION
if: |
matrix.PHP_VERSION != env.PHP_STABLE_VERSION
&& matrix.NODE_VERSION != env.NODE_STABLE_VERSION
with:
context: template
platforms: linux/arm64
Expand All @@ -73,20 +80,79 @@ jobs:
PHP_VERSION=${{ matrix.PHP_VERSION }}
PHP_MAJOR_VERSION=${{ steps.php-version.outputs._0 }}
PHP_MINOR_VERSION=${{ steps.php-version.outputs._1 }}
NODE_VERSION=${{ matrix.NODE_VERSION }}
push: true
tags: |
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ env.OLS_VERSION }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}-node${{ matrix.NODE_VERSION }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ steps.ols-version.outputs._0 }}.${{ steps.ols-version.outputs._1 }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}-node${{ matrix.NODE_VERSION }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ steps.ols-version.outputs._0 }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}-node${{ matrix.NODE_VERSION }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}-node${{ matrix.NODE_VERSION }}
no-cache: ${{ github.event_name == 'workflow_dispatch' && true || false }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/ndigitals/openlitespeed
cache-to: type=inline

# https://github.com/marketplace/actions/build-and-push-docker-images
- name: Build and Push Docker Image - latest PHP, non-latest Node
uses: docker/build-push-action@v5
if: |
matrix.PHP_VERSION == env.PHP_STABLE_VERSION
&& matrix.NODE_VERSION != env.NODE_STABLE_VERSION
with:
context: template
platforms: linux/arm64
provenance: false
build-args: |
OLS_VERSION=${{ env.OLS_VERSION }}
PHP_VERSION=${{ matrix.PHP_VERSION }}
PHP_MAJOR_VERSION=${{ steps.php-version.outputs._0 }}
PHP_MINOR_VERSION=${{ steps.php-version.outputs._1 }}
NODE_VERSION=${{ matrix.NODE_VERSION }}
push: true
tags: |
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ env.OLS_VERSION }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}-node${{ matrix.NODE_VERSION }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ steps.ols-version.outputs._0 }}.${{ steps.ols-version.outputs._1 }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}-node${{ matrix.NODE_VERSION }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ steps.ols-version.outputs._0 }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}-node${{ matrix.NODE_VERSION }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}-node${{ matrix.NODE_VERSION }}
no-cache: ${{ github.event_name == 'workflow_dispatch' && true || false }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/ndigitals/openlitespeed
cache-to: type=inline

# https://github.com/marketplace/actions/build-and-push-docker-images
- name: Build and Push Docker Image - latest Node, non-latest PHP
uses: docker/build-push-action@v5
if: |
matrix.PHP_VERSION != env.PHP_STABLE_VERSION
&& matrix.NODE_VERSION == env.NODE_STABLE_VERSION
with:
context: template
platforms: linux/arm64
provenance: false
build-args: |
OLS_VERSION=${{ env.OLS_VERSION }}
PHP_VERSION=${{ matrix.PHP_VERSION }}
PHP_MAJOR_VERSION=${{ steps.php-version.outputs._0 }}
PHP_MINOR_VERSION=${{ steps.php-version.outputs._1 }}
NODE_VERSION=${{ matrix.NODE_VERSION }}
push: true
tags: |
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ env.OLS_VERSION }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}-node${{ matrix.NODE_VERSION }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ env.OLS_VERSION }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ steps.ols-version.outputs._0 }}.${{ steps.ols-version.outputs._1 }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }-node${{ matrix.NODE_VERSION }}}
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ steps.ols-version.outputs._0 }}.${{ steps.ols-version.outputs._1 }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ steps.ols-version.outputs._0 }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}-node${{ matrix.NODE_VERSION }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ steps.ols-version.outputs._0 }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}-node${{ matrix.NODE_VERSION }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}
no-cache: ${{ github.event_name == 'workflow_dispatch' && true || false }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/ndigitals/openlitespeed
cache-to: type=inline

# https://github.com/marketplace/actions/build-and-push-docker-images
- name: Build and Push Docker Image - latest
- name: Build and Push Docker Image - latest PHP & Node
uses: docker/build-push-action@v5
if: matrix.PHP_VERSION == env.PHP_STABLE_VERSION
if: |
matrix.PHP_VERSION == env.PHP_STABLE_VERSION
&& matrix.NODE_VERSION == env.NODE_STABLE_VERSION
with:
context: template
platforms: linux/arm64
Expand All @@ -96,11 +162,16 @@ jobs:
PHP_VERSION=${{ matrix.PHP_VERSION }}
PHP_MAJOR_VERSION=${{ steps.php-version.outputs._0 }}
PHP_MINOR_VERSION=${{ steps.php-version.outputs._1 }}
NODE_VERSION=${{ matrix.NODE_VERSION }}
push: true
tags: |
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ env.OLS_VERSION }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}-node${{ matrix.NODE_VERSION }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ env.OLS_VERSION }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ steps.ols-version.outputs._0 }}.${{ steps.ols-version.outputs._1 }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}-node${{ matrix.NODE_VERSION }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ steps.ols-version.outputs._0 }}.${{ steps.ols-version.outputs._1 }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ steps.ols-version.outputs._0 }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}-node${{ matrix.NODE_VERSION }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:${{ steps.ols-version.outputs._0 }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }-node${{ matrix.NODE_VERSION }}}
${{ env.REGISTRY }}/ndigitals/openlitespeed:lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}
${{ env.REGISTRY }}/ndigitals/openlitespeed:latest
no-cache: ${{ github.event_name == 'workflow_dispatch' && true || false }}
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/test-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
env:
OLS_VERSION: 1.7.19
PHP_STABLE_VERSION: '8.3.2'
NODE_STABLE_VERSION: '20'
REGISTRY: ghcr.io

jobs:
Expand All @@ -22,6 +23,10 @@ jobs:
- '8.1.27'
- '8.2.15'
- '8.3.2'
NODE_VERSION:
- '16'
- '18'
- '20'

steps:
- name: Checkout
Expand Down Expand Up @@ -63,9 +68,10 @@ jobs:
PHP_VERSION=${{ matrix.PHP_VERSION }}
PHP_MAJOR_VERSION=${{ steps.php-version.outputs._0 }}
PHP_MINOR_VERSION=${{ steps.php-version.outputs._1 }}
NODE_VERSION=${{ matrix.NODE_VERSION }}
load: true
push: false
tags: openlitespeed:${{ env.OLS_VERSION }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}
tags: openlitespeed:${{ env.OLS_VERSION }}-lsphp${{ steps.php-version.outputs._0 }}${{ steps.php-version.outputs._1 }}-node${{ matrix.NODE_VERSION }}
no-cache: ${{ github.event_name == 'workflow_dispatch' && true || false }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/ndigitals/openlitespeed
cache-to: type=inline
Expand Down
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@ Install a lightweight OpenLiteSpeed container using the Stable version in Debian

## Supported tags

- `1.7.19-lsphp83`, `1.7-lsphp83`, `1-lsphp83`, `lsphp83`
- `1.7.19-lsphp82`, `1.7-lsphp82`, `1-lsphp82`, `lsphp82`
- `1.7.19-lsphp81`, `1.7-lsphp81`, `1-lsphp81`, `lsphp81`
- `1.7.19-lsphp80`, `1.7-lsphp80`, `1-lsphp80`, `lsphp80`
- `1.7.19-lsphp83-node20`, `1.7.19-lsphp83`, `1.7-lsphp83-node20`, `1.7-lsphp83`, `1-lsphp83-node20`, `1-lsphp83`, `lsphp83-node20`, `lsphp83`
- `1.7.19-lsphp83-node18`, `1.7-lsphp83-node18`, `1-lsphp83-node18`, `lsphp83-node18`
- `1.7.19-lsphp83-node16`, `1.7-lsphp83-node16`, `1-lsphp83-node16`, `lsphp83-node16`
- `1.7.19-lsphp82-node20`, `1.7.19-lsphp82`, `1.7-lsphp82-node20`, `1.7-lsphp82`, `1-lsphp82-node20`, `1-lsphp82`, `lsphp82-node20`, `lsphp82`
- `1.7.19-lsphp82-node18`, `1.7-lsphp82-node18`, `1-lsphp82-node18`, `lsphp82-node18`
- `1.7.19-lsphp82-node16`, `1.7-lsphp82-node16`, `1-lsphp82-node16`, `lsphp82-node16`
- `1.7.19-lsphp81-node20`, `1.7.19-lsphp81`, `1.7-lsphp81-node20`, `1.7-lsphp81`, `1-lsphp81-node20`, `1-lsphp81`, `lsphp81-node20`, `lsphp81`
- `1.7.19-lsphp81-node18`, `1.7-lsphp81-node18`, `1-lsphp81-node18`, `lsphp81-node18`
- `1.7.19-lsphp81-node16`, `1.7-lsphp81-node16`, `1-lsphp81-node16`, `lsphp81-node16`
- `1.7.19-lsphp80-node20`, `1.7.19-lsphp80`, `1.7-lsphp80-node20`, `1.7-lsphp80`, `1-lsphp80-node20`, `1-lsphp80`, `lsphp80-node20`, `lsphp80`
- `1.7.19-lsphp80-node18`, `1.7-lsphp80-node18`, `1-lsphp80-node18`, `lsphp80-node18`
- `1.7.19-lsphp80-node16`, `1.7-lsphp80-node16`, `1-lsphp80-node16`, `lsphp80-node16`
- `1.7.18-lsphp83`, `1.7.18-lsphp82`, `1.7.18-lsphp81`, `1.7.18-lsphp80`
- `1.7.17-lsphp82`, `1.7.17-lsphp81`, `1.7.17-lsphp80`
- `1.7.16-lsphp82`, `1.7.16-lsphp81`, `1.7.16-lsphp80`
Expand Down Expand Up @@ -80,6 +88,12 @@ Feel free to substitute the "openlitespeed" to the "Container_ID" if you did not
docker stop openlitespeed
```

## NodeJS Support

This image includes NodeJS in order to run NodeJS apps. Choose a tag that includes the version of NodeJS needed.

See official documentation for more details on running NodeJS under OpenLiteSpeed. https://openlitespeed.org/kb/running-node-js-apps-with-openlitespeed/

## Support & Feedback

If you still have a question after using OpenLiteSpeed Docker, you have a few options.
Expand Down
4 changes: 4 additions & 0 deletions template/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ ARG OLS_VERSION
ARG PHP_VERSION
ARG PHP_MAJOR_VERSION
ARG PHP_MINOR_VERSION
ARG NODE_VERSION

FROM wordpress:cli-php${PHP_MAJOR_VERSION}.${PHP_MINOR_VERSION} AS wp-cli

ARG OLS_VERSION
ARG PHP_VERSION
ARG PHP_MAJOR_VERSION
ARG PHP_MINOR_VERSION
ARG NODE_VERSION

FROM litespeedtech/openlitespeed:${OLS_VERSION}-lsphp${PHP_MAJOR_VERSION}0 AS ols

Expand All @@ -24,6 +26,7 @@ ARG OLS_VERSION
ARG PHP_VERSION
ARG PHP_MAJOR_VERSION
ARG PHP_MINOR_VERSION
ARG NODE_VERSION

ENV OLS_VERSION=${OLS_VERSION}
ENV PHP_VERSION=${PHP_VERSION}
Expand All @@ -32,6 +35,7 @@ ENV PHP_MINOR_VERSION=${PHP_MINOR_VERSION}
ENV OLS_ADMIN_PHP_VERSION=7.4.33
ENV OLS_ADMIN_PHP_MAJOR_VERSION=7
ENV OLS_ADMIN_PHP_MINOR_VERSION=4
ENV NODE_VERSION=${NODE_VERSION}

COPY *.sh /build/

Expand Down
4 changes: 2 additions & 2 deletions template/prepare-runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
apt-get update -y
apt-get install $MINIMAL_APT_GET_ARGS $SETUP_PACKAGES

# Prepare to install Node 16.
curl -sL https://deb.nodesource.com/setup_16.x | bash -
# Prepare to install Node.
curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash -

# Prepare to install Yarn.
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
Expand Down

0 comments on commit 9ed3d3b

Please sign in to comment.