From 2793b5a67f9fda92d4628c894b672d1aa7bdbbaa Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Sun, 20 Oct 2024 17:21:59 +0300 Subject: [PATCH] Update Node versions --- Dockerfile | 5 +---- README.md | 21 +++++++++++---------- docker-bake.hcl | 29 ++++++++++++++++++----------- gulp/package.json | 5 ++++- 4 files changed, 34 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3a8c7da..bfb373f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,7 @@ -ARG NODE_VERSION +ARG NODE_VERSION=20 FROM node:${NODE_VERSION}-alpine -LABEL org.opencontainers.image.authors="Druid.fi" maintainer="Druid.fi" -LABEL org.opencontainers.image.source="https://github.com/druidfi/donn" repository="https://github.com/druidfi/donn" - ENV DATA_PATH=/data \ DIST_FOLDER=dist \ GULP_PATH=/opt/gulp \ diff --git a/README.md b/README.md index f2eb244..abd59c8 100644 --- a/README.md +++ b/README.md @@ -13,21 +13,20 @@ Docker image which compiles CSS (from SASS) and JS files. ## Tools - Gulp 4 (https://www.npmjs.com/package/gulp) - Frozen in time as there is no certainty for v5. -- Webpack [TODO] ## Using image in your project Examples on Drupal project: -```shell +```console docker run -it --rm -v $(pwd)/path/to/theme:/data druidfi/donn:node-18 gulp production ``` -```shell +```console docker run -it --rm -v $(pwd)/path/to/theme:/data druidfi/donn:node-18 gulp development ``` -```shell +```console docker run -it --rm -v $(pwd)/path/to/theme:/data druidfi/donn:node-18 gulp watch ``` @@ -35,7 +34,7 @@ docker run -it --rm -v $(pwd)/path/to/theme:/data druidfi/donn:node-18 gulp watc You can add these to e.g. `tools/make/project/theme.mk` and have `NODE_VERSION=18` in your `.env` file: -```shell +```makefile THEME_PATH := $(shell pwd)/$(WEBROOT)/themes/custom/druid_theme PHONY += drupal-build-theme @@ -53,21 +52,23 @@ drupal-watch-theme: Environment variables (and their default values) which can be used to change configuration: -- `BROWSERSLIST="last 2 version, not dead"` -- `DIST_FOLDER=dist` -- `SRC_FOLDER=src` +```env +BROWSERSLIST="last 2 version, not dead" +DIST_FOLDER=dist +SRC_FOLDER=src +``` ## Build images Locally with M1: -```shell +```console docker buildx bake -f docker-bake.hcl --pull --progress plain --no-cache --load --set "*.platform=linux/arm64" ``` Build and push images to Docker Hub: -```shell +```console docker buildx bake -f docker-bake.hcl --pull --no-cache --push ``` diff --git a/docker-bake.hcl b/docker-bake.hcl index fcfed96..db88de9 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -3,24 +3,23 @@ variable "REPO_NAME" { } variable "VERSION" { - default = "1.1" + default = "1.2" } group "default" { - targets = ["donn-node-16", "donn-node-18", "donn-node-20"] + targets = ["donn-node-18", "donn-node-20", "donn-node-22"] } target "common" { platforms = ["linux/amd64", "linux/arm64"] context = "." -} - -target "donn-node-16" { - inherits = ["common"] - args = { - NODE_VERSION = 16 + labels = { + "org.opencontainers.image.url" = "https://github.com/druidfi/donn" + "org.opencontainers.image.source" = "https://github.com/druidfi/donn" + "org.opencontainers.image.licenses" = "MIT" + "org.opencontainers.image.vendor" = "Druid Oy" + "org.opencontainers.image.created" = "${timestamp()}" } - tags = ["${REPO_NAME}:node-16", "${REPO_NAME}:${VERSION}-node-16"] } target "donn-node-18" { @@ -28,7 +27,7 @@ target "donn-node-18" { args = { NODE_VERSION = 18 } - tags = ["${REPO_NAME}:node-18", "${REPO_NAME}:${VERSION}-node-18", "${REPO_NAME}:latest"] + tags = ["${REPO_NAME}:node-18", "${REPO_NAME}:${VERSION}-node-18"] } target "donn-node-20" { @@ -36,5 +35,13 @@ target "donn-node-20" { args = { NODE_VERSION = 20 } - tags = ["${REPO_NAME}:node-20", "${REPO_NAME}:${VERSION}-node-20", "${REPO_NAME}:latest"] + tags = ["${REPO_NAME}:node-20", "${REPO_NAME}:${VERSION}-node-20"] +} + +target "donn-node-22" { + inherits = ["common"] + args = { + NODE_VERSION = 22 + } + tags = ["${REPO_NAME}:node-22", "${REPO_NAME}:${VERSION}-node-22", "${REPO_NAME}:latest"] } diff --git a/gulp/package.json b/gulp/package.json index dfe79af..d9f21fb 100644 --- a/gulp/package.json +++ b/gulp/package.json @@ -1,6 +1,6 @@ { "name": "donn", - "version": "1.0.0", + "version": "1.2.0", "description": "Gulp configuration for CSS and JS compiling", "author": "Druid", "repository": "https://github.com/druidfi/donn", @@ -25,5 +25,8 @@ "gulp-sass-glob": "^1.1.0", "gulp-terser": "^2.1.0", "sass": "^1.49.9" + }, + "engines": { + "node": ">=18.0.0" } }