Skip to content

Commit bb428d2

Browse files
authored
Initial Version for Node 22.11.0 with .NET 9 (#1)
Co-authored-by: Raphael Strotz <[email protected]>
1 parent 8f5492d commit bb428d2

File tree

8 files changed

+196
-0
lines changed

8 files changed

+196
-0
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These owners will be the default owners for everything in the repo and
2+
# will be requested for review when someone opens a pull request.
3+
* @swissgrc/dev-infra

.github/renovate.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"github>swissgrc/renovate-presets:docker"
5+
],
6+
"packageRules": [
7+
{
8+
"matchDepNames": [ "ghcr.io/swissgrc/azure-pipelines-dotnet" ],
9+
"description": "No .NET SDK Major Updates",
10+
"extends": [ ":disableMajorUpdates" ]
11+
},
12+
{
13+
"matchDepNames": [ "nodejs/node" ],
14+
"description": "No Node Major Updates",
15+
"extends": [ ":disableMajorUpdates" ]
16+
}
17+
]
18+
}

.github/workflows/linter.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Lint Code Base
2+
3+
on:
4+
pull_request:
5+
branches: [develop]
6+
7+
jobs:
8+
lint-image:
9+
name: Lint Code Base
10+
uses: swissgrc/.github/.github/workflows/lint-image.yml@main
11+
secrets:
12+
gh-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [develop]
6+
release:
7+
types: [published]
8+
pull_request:
9+
branches: [develop]
10+
11+
jobs:
12+
publish-image:
13+
name: Build and push Docker image
14+
uses: swissgrc/.github/.github/workflows/publish-image.yml@main
15+
with:
16+
image-name: swissgrc/azure-pipelines-node
17+
default-latest-tag: true
18+
additional-latest-tag-name: latest-22-net9
19+
default-unstable-tag: true
20+
additional-unstable-tag-name: unstable-22-net9
21+
release-tag-suffix: net9
22+
secrets:
23+
gh-token: ${{ secrets.GITHUB_TOKEN }}
24+
docker-username: ${{ secrets.DOCKER_USERNAME }}
25+
docker-password: ${{ secrets.DOCKER_PASSWORD }}

.github/workflows/sonarcloud.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: SonarCloud
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
10+
jobs:
11+
sonarcloud:
12+
name: SonarCloud
13+
uses: swissgrc/.github/.github/workflows/sonarcloud.yml@main
14+
secrets:
15+
gh-token: ${{ secrets.GITHUB_TOKEN }}
16+
sonar-token: ${{ secrets.SONAR_TOKEN }}

Dockerfile

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Base image containing dependencies used in builder and final image
2+
FROM ghcr.io/swissgrc/azure-pipelines-dotnet:9.0.100 AS base
3+
4+
5+
# Builder image
6+
FROM base AS build
7+
8+
# Make sure to fail due to an error at any stage in shell pipes
9+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
10+
11+
# renovate: datasource=repology depName=debian_12/curl versioning=deb
12+
ENV CURL_VERSION=7.88.1-10+deb12u8
13+
# renovate: datasource=repology depName=debian_12/gnupg2 versioning=deb
14+
ENV GNUPG_VERSION=2.2.40-1.1
15+
16+
RUN apt-get update -y && \
17+
# Install necessary dependencies
18+
apt-get install -y --no-install-recommends \
19+
curl=${CURL_VERSION} \
20+
gnupg=${GNUPG_VERSION} && \
21+
# Add NodeJS PPA
22+
curl --proto "=https" -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
23+
| gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
24+
NODE_MAJOR=22 && \
25+
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" \
26+
| tee /etc/apt/sources.list.d/nodesource.list
27+
28+
29+
# Final image
30+
FROM base AS final
31+
32+
LABEL org.opencontainers.image.vendor="Swiss GRC AG"
33+
LABEL org.opencontainers.image.authors="Swiss GRC AG <[email protected]>"
34+
LABEL org.opencontainers.image.title="azure-pipelines-node"
35+
LABEL org.opencontainers.image.documentation="https://github.com/swissgrc/docker-azure-pipelines-node22-net9"
36+
37+
# Make sure to fail due to an error at any stage in shell pipes
38+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
39+
40+
WORKDIR /
41+
# Copy Git LFS & NodeJS PPA keyring
42+
COPY --from=build /etc/apt/keyrings/ /etc/apt/keyrings
43+
COPY --from=build /etc/apt/sources.list.d/ /etc/apt/sources.list.d
44+
45+
# Install NodeJS
46+
47+
# renovate: datasource=github-tags depName=nodejs/node extractVersion=^v(?<version>.*)$
48+
ENV NODE_VERSION=22.11.0
49+
50+
RUN apt-get update -y && \
51+
# Install NodeJs
52+
apt-get install -y --no-install-recommends nodejs=${NODE_VERSION}-1nodesource1 && \
53+
# Clean up
54+
apt-get clean && \
55+
rm -rf /var/lib/apt/lists/* && \
56+
# Smoke test
57+
node -v
58+
59+
# Install Yarn
60+
61+
# renovate: datasource=github-tags depName=yarnpkg/yarn extractVersion=^v(?<version>.*)$
62+
ENV YARN_VERSION=1.22.22
63+
64+
RUN npm install -g --ignore-scripts yarn@${YARN_VERSION} && \
65+
npm cache clean --force && \
66+
# Smoke test
67+
yarn --version

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,48 @@
11
# Docker image for running Node.js commands in an Azure Pipelines container job
22

3+
<!-- markdownlint-disable MD013 -->
4+
[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/swissgrc/docker-azure-pipelines-node22-net9/blob/main/LICENSE) [![Build](https://img.shields.io/github/actions/workflow/status/swissgrc/docker-azure-pipelines-node22-net9/publish.yml?branch=develop&style=flat-square)](https://github.com/swissgrc/docker-azure-pipelines-node22-net9/actions/workflows/publish.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=swissgrc_docker-azure-pipelines-node22-net9&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=swissgrc_docker-azure-pipelines-node22-net9) [![Pulls](https://img.shields.io/docker/pulls/swissgrc/azure-pipelines-node.svg?style=flat-square)](https://hub.docker.com/r/swissgrc/azure-pipelines-node) [![Stars](https://img.shields.io/docker/stars/swissgrc/azure-pipelines-node.svg?style=flat-square)](https://hub.docker.com/r/swissgrc/azure-pipelines-node)
5+
<!-- markdownlint-restore -->
6+
37
🐳 Docker image to run Node.js commands in [Azure Pipelines container jobs].
48

9+
## Usage
10+
11+
This image can be used to run Node.js commands in [Azure Pipelines container jobs].
12+
13+
The following software is additionally available in the image:
14+
15+
| Software | Included since |
16+
|------------|----------------|
17+
| Docker CLI | 22.11.0 |
18+
| Git | 22.11.0 |
19+
| .NET 9 | 22.11.0 |
20+
21+
### Azure Pipelines Container Job
22+
23+
To use the image in an Azure Pipelines Container Job, add one of the following example tasks and use it with the `container` property.
24+
25+
The following example shows the container used for a deployment step with a Azure CLI command:
26+
27+
```yaml
28+
- stage: deploy
29+
jobs:
30+
- deployment: runAzureCLI
31+
container: swissgrc/azure-pipelines-node:latest-22-net9
32+
environment: smarthotel-dev
33+
strategy:
34+
runOnce:
35+
deploy:
36+
steps:
37+
- bash: |
38+
node --version
39+
```
40+
41+
### Tags
42+
43+
| Tag | Description | Base Image | Node.js | Yarn | Size |
44+
|------------------|-------------------------------------------------|-----------------------------------------|---------|---------|---------------------------------------------------------------------------------------------------------------------------------------|
45+
| unstable | Latest unstable release (from `develop` branch) | swissgrc/azure-pipelines-dotnet:9.0.100 | 22.11.0 | 1.22.22 | ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/swissgrc/azure-pipelines-node/unstable?style=flat-square) |
46+
| unstable-22-net9 | Indentical to `unstable` tag | | | | ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/swissgrc/azure-pipelines-node/unstable-22-net9?style=flat-square) |
47+
548
[Azure Pipelines container jobs]: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/container-phases

sonar-project.properties

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
sonar.projectKey=swissgrc_docker-azure-pipelines-node22-net9
2+
sonar.organization=swissgrc-opensource
3+
4+
# This is the name and version displayed in the SonarCloud UI.
5+
sonar.projectName=docker-azure-pipelines-node22-net9
6+
#sonar.projectVersion=1.0
7+
8+
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
9+
#sonar.sources=.
10+
11+
# Encoding of the source code. Default is default system encoding
12+
#sonar.sourceEncoding=UTF-8

0 commit comments

Comments
 (0)