Skip to content

Commit

Permalink
Update Node versions
Browse files Browse the repository at this point in the history
  • Loading branch information
back-2-95 committed Oct 20, 2024
1 parent 212746b commit 2793b5a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 26 deletions.
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,28 @@ 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
```

## Using it in druidfi/tools

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
Expand All @@ -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
```

Expand Down
29 changes: 18 additions & 11 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,45 @@ 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" {
inherits = ["common"]
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" {
inherits = ["common"]
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"]
}
5 changes: 4 additions & 1 deletion gulp/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -25,5 +25,8 @@
"gulp-sass-glob": "^1.1.0",
"gulp-terser": "^2.1.0",
"sass": "^1.49.9"
},
"engines": {
"node": ">=18.0.0"
}
}

0 comments on commit 2793b5a

Please sign in to comment.