-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create node docker images based on node 20 LTS version
- Loading branch information
1 parent
2e2c705
commit 99a0bdf
Showing
47 changed files
with
3,356 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Docker | ||
# Build and push php images to Docker Hub | ||
name: Build and push | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'build/**' | ||
- '.github/**' | ||
branches: | ||
- 'main' | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
node20-base: | ||
name: Build and push node20 base image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./build/node20/base | ||
file: ./build/node20/base/Dockerfile | ||
cache-from: type=gha,scope=node20 | ||
cache-to: type=gha,scope=node20,mode=max | ||
push: true | ||
tags: anzusystems/node:${{ github.ref_name }}-node20,anzusystems/node:latest-node20 | ||
|
||
node20-nginx: | ||
name: Build and push node20 nginx image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./build/node20/nginx | ||
file: ./build/node20/nginx/Dockerfile | ||
cache-from: type=gha,scope=node20-nginx | ||
cache-to: type=gha,scope=node20-nginx,mode=max | ||
push: true | ||
tags: anzusystems/node:${{ github.ref_name }}-node20-nginx,anzusystems/node:latest-node20-nginx | ||
|
||
node20-nginx-browsers: | ||
name: Build and push node20 nginx-browsers image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./build/node20/nginx-browsers | ||
file: ./build/node20/nginx-browsers/Dockerfile | ||
cache-from: type=gha,scope=node20-nginx-browsers | ||
cache-to: type=gha,scope=node20-nginx-browsers,mode=max | ||
push: true | ||
tags: anzusystems/node:${{ github.ref_name }}-node20-nginx-browsers,anzusystems/node:latest-node20-nginx-browsers | ||
|
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,2 @@ | ||
.idea | ||
.vscode |
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,71 @@ | ||
AnzuSystems Node Development Docker Images by Petit Press a.s. (www.sme.sk) | ||
===== | ||
|
||
Main Node images from which all our Node flavors (versions with base, browsers...) are built. It is based on [official Node images](https://hub.docker.com/_/node) using our custom configuration. | ||
Additionally, it contains [nginx](https://nginx.org/), [mariadb client](https://mariadb.com/downloads/) packages and many more. | ||
|
||
[[_TOC_]] | ||
|
||
## What's inside | ||
|
||
- Node 20 | ||
- NPM | ||
- Yarn | ||
- AuditJS | ||
- Supervisor | ||
- Nginx variant: | ||
- Nginx | ||
- Nginx-xslt | ||
- Nginx-geoip | ||
- Nginx-image-filter | ||
- Nginx-njs | ||
- Browsers variant: | ||
- google chrome | ||
- firefox | ||
- xvfb + other X libs | ||
|
||
See versions in [version.conf](https://github.com/anzusystems/docker-node/blob/main/versions.conf) file. | ||
|
||
### Special common commands | ||
|
||
- `env-config` - Script to run setup of config.json file using .env files and exported variables | ||
- `fix-user` - Corrects UID and GID for container user according to host UID and GID if needed | ||
|
||
## Git Hooks | ||
|
||
Setup pre-commit hook: | ||
|
||
- `.git/hooks/pre-commit` | ||
|
||
#!/bin/bash | ||
# | ||
# Run update.sh script before commit | ||
|
||
./update.sh | ||
git add .github build | ||
|
||
## Auto-generation | ||
|
||
Script: | ||
|
||
./update.sh | ||
|
||
This script has to be run before every commit. | ||
|
||
Script is used to autogenerate following files/folders: | ||
|
||
- `build/nodeXY/` - autogenerated from: | ||
- `config/all/` | ||
- `config/all-X.Y/` | ||
- `config/browsers/` | ||
- `config/browsers-X.Y/` | ||
- `config/nginx/` | ||
- `config/nginx-X.Y/` | ||
- `template.Dockerfile` | ||
- `variant-*.Dockerfile` | ||
- `versions.conf` | ||
- `.github/workflows/docker.yml` - autogenerated from: | ||
- `docker.yml.template` | ||
- `docker.yml.job.template` | ||
|
||
Do not change autogenerated files/folders directly. |
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,106 @@ | ||
# | ||
# NOTE: | ||
# THIS DOCKERFILE IS GENERATED VIA "update.sh". | ||
# PLEASE DO NOT EDIT IT DIRECTLY! | ||
# CHECK README FOR MORE INFO. | ||
# | ||
FROM node:20.12.2 | ||
|
||
LABEL maintainer="Lubomir Stanko <[email protected]>" | ||
|
||
# ---------------------------------------------------------------------------------------------------------------------- | ||
# ENVIRONMENT VARIABLES | ||
# ---------------------------------------------------------------------------------------------------------------------- | ||
# Common environment variables | ||
ENV CONFIG_OWNER_NAME=node \ | ||
CONFIG_GROUP_NAME=node \ | ||
CONTAINER_STOP_LOG_FILE="/var/www/html/var/log/container_stop.log" \ | ||
COREPACK_HOME="/usr/lib/node/corepack" \ | ||
MAIN_TERMINATED_FILE="/var/www/html/var/log/main-terminated" \ | ||
NPM_CONFIG_LOGLEVEL=notice \ | ||
YARN_CACHE_FOLDER="/var/cache/yarn" \ | ||
YARN_ENABLE_TELEMETRY=0 \ | ||
# Unset yarn version - it could break CI and we don't need it | ||
YARN_VERSION= | ||
# Packages | ||
ENV RUN_DEPS="ca-certificates \ | ||
curl \ | ||
g++ \ | ||
gcc \ | ||
gettext-base \ | ||
git \ | ||
gnupg \ | ||
less \ | ||
logrotate \ | ||
lsb-release \ | ||
make \ | ||
openssh-client \ | ||
procps \ | ||
vim \ | ||
wget" | ||
|
||
# ---------------------------------------------------------------------------------------------------------------------- | ||
# PACKAGES | ||
# ---------------------------------------------------------------------------------------------------------------------- | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
${RUN_DEPS} \ | ||
supervisor=4.2.5-1 && \ | ||
# Cleanup | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# ---------------------------------------------------------------------------------------------------------------------- | ||
# NPM | ||
# Install static npm version | ||
# ---------------------------------------------------------------------------------------------------------------------- | ||
RUN npm install --location=global [email protected] && \ | ||
npm install --location=global [email protected] && \ | ||
mkdir -p ${COREPACK_HOME} && \ | ||
corepack prepare [email protected] --activate && \ | ||
corepack enable && \ | ||
# Node cache cleanup | ||
npm cache clean --force && \ | ||
yarn cache clean --all | ||
# Versions of local tools | ||
RUN echo "node version: $(node -v) \n" \ | ||
"npm version: $(npm -v) \n" \ | ||
"yarn version: $(yarn -v)" | ||
|
||
# ---------------------------------------------------------------------------------------------------------------------- | ||
# USER SETUP | ||
# ---------------------------------------------------------------------------------------------------------------------- | ||
RUN sed -i 's/^#alias l/alias l/g' /home/node/.bashrc && \ | ||
echo "update-notifier=false" > /home/node/.npmrc && \ | ||
mkdir -p \ | ||
${YARN_CACHE_FOLDER} \ | ||
/usr/local/lib/node_modules \ | ||
/var/run/supervisor \ | ||
/var/www/html/var && \ | ||
chown node:node -R \ | ||
${COREPACK_HOME} \ | ||
${YARN_CACHE_FOLDER} \ | ||
/home/node/.npmrc \ | ||
/usr/local/bin \ | ||
/usr/local/lib/node_modules \ | ||
/var/run/supervisor \ | ||
/var/www/html | ||
|
||
##<autogenerated>## | ||
##</autogenerated>## | ||
|
||
# ---------------------------------------------------------------------------------------------------------------------- | ||
# RUN CONFIGURATION | ||
# ---------------------------------------------------------------------------------------------------------------------- | ||
COPY --chown=${CONFIG_OWNER_NAME}:${CONFIG_GROUP_NAME} ./etc /etc | ||
COPY --chown=${CONFIG_OWNER_NAME}:${CONFIG_GROUP_NAME} ./usr /usr | ||
|
||
# ---------------------------------------------------------------------------------------------------------------------- | ||
# RUN | ||
# Run setup and entrypoint start | ||
# ---------------------------------------------------------------------------------------------------------------------- | ||
WORKDIR /var/www/html | ||
|
||
USER node | ||
|
||
ENTRYPOINT ["docker-custom-entrypoint"] |
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,23 @@ | ||
[unix_http_server] | ||
file=/var/run/supervisor/supervisor.sock | ||
chmod=0700 | ||
username=docker | ||
password=docker | ||
|
||
[supervisorctl] | ||
serverurl=unix:///var/run/supervisor/supervisor.sock | ||
username=docker | ||
password=docker | ||
|
||
[supervisord] | ||
nodaemon=true | ||
logfile=/dev/stdout | ||
logfile_maxbytes=0 | ||
pidfile=/var/run/supervisor/supervisord.pid | ||
loglevel=info | ||
|
||
[rpcinterface:supervisor] | ||
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface | ||
|
||
[include] | ||
files = /etc/supervisor/conf.d/*.conf |
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,3 @@ | ||
#!/bin/bash | ||
|
||
exec "$@" |
Oops, something went wrong.