Skip to content

Commit 7b1d008

Browse files
fwilheCCFennerstippi2
authored
Build images for node 10, 12 and 14 (#17)
Co-authored-by: Christopher Fenner <[email protected]> Co-authored-by: Stephan Aßmus <[email protected]>
1 parent 19c552e commit 7b1d008

10 files changed

Lines changed: 66 additions & 57 deletions

File tree

.github/workflows/build.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build images and push (on master branch or on schedule)
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
schedule:
8+
- cron: '0 0 * * 0'
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
base-image-tag: [10-buster, 12-buster, 14-buster]
17+
steps:
18+
- uses: actions/checkout@master
19+
- name: Test
20+
run: |
21+
chmod +x runTests.sh && ./runTests.sh ${{ matrix.base-image-tag }}
22+
- name: Build
23+
run: |
24+
docker build --build-arg=BASE_IMAGE_TAG=${{ matrix.base-image-tag }} --tag ppiper/node-browsers:${{ matrix.base-image-tag }} .
25+
- name: Tag latest image
26+
if: ${{ matrix.base-image-tag == 10-buster }}
27+
run: docker tag ppiper/node-browsers:${{ matrix.base-image-tag }} ppiper/node-browsers:latest
28+
- name: Push
29+
if: ${{ github.ref == 'ref/head/master' }}
30+
run: |
31+
echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USER }} --password-stdin
32+
docker push ppiper/node-browsers:${{ matrix.base-image-tag }}
33+
if [ "${{ matrix.base-image-tag }}" == 10-buster ]; then
34+
docker push ppiper/node-browsers:latest
35+
fi

.github/workflows/lint.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ jobs:
1313
# https://github.com/hadolint/hadolint/wiki/DL3016
1414
# https://github.com/hadolint/hadolint/wiki/DL3018
1515
# https://github.com/hadolint/hadolint/wiki/DL3015
16-
args: --ignore DL3008 --ignore DL3013 --ignore DL3016 --ignore DL3018 --ignore DL3015
16+
# https://github.com/hadolint/hadolint/wiki/DL3006 Make it work to build multiple node versions in one dockerfile via matrix build
17+
args: --ignore DL3008 --ignore DL3013 --ignore DL3016 --ignore DL3018 --ignore DL3015 --ignore DL3006

.github/workflows/push.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@ on:
1010
jobs:
1111
create-release:
1212
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
base-image-tag: [10-buster, 12-buster, 14-buster]
1316
steps:
1417
- uses: actions/checkout@v1
18+
- name: Test
19+
run: |
20+
chmod +x runTests.sh && ./runTests.sh ${{ matrix.base-image-tag }}
1521
- name: Prepare Release
1622
run: |
1723
CURRENT_VERSION_LONG=$(curl --silent "https://api.github.com/repos/SAP/devops-docker-node-browsers/releases" | jq -r '.[].tag_name' | head -n1)
@@ -26,14 +32,16 @@ jobs:
2632
fi
2733
echo "::set-env name=PIPER_version::$NEXT_VERSION"
2834
29-
- name: Build, test and push
35+
- name: Build and push
3036
run: |
3137
echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USER }} --password-stdin
32-
docker build -t ppiper/node-browsers:${{ env.PIPER_version }} .
33-
docker build -t ppiper/node-browsers:${{ env.PIPER_version }}-node12 node12
38+
docker build --build-arg=BASE_IMAGE_TAG=${{ matrix.base-image-tag }} --tag ppiper/node-browsers:${{ env.PIPER_version }}-${{ matrix.base-image-tag }} .
39+
docker push ppiper/node-browsers:${{ env.PIPER_version }}-${{ matrix.base-image-tag }}
40+
- name: Tag and push node 10 image
41+
if: ${{ matrix.base-image-tag == 10-buster }}
42+
run: |
43+
docker tag ppiper/node-browsers:10-buster ppiper/node-browsers:${{ env.PIPER_version }}
3444
docker push ppiper/node-browsers:${{ env.PIPER_version }}
35-
docker push ppiper/node-browsers:${{ env.PIPER_version }}-node12
36-
3745
- uses: SAP/project-piper-action@master
3846
with:
3947
piper-version: latest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
test-project
2+
.vscode

.travis.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# node-10 is LTS and required for sap approuter. EOL: 2021-04-01
2-
FROM node:10-buster
1+
ARG BASE_IMAGE_TAG
2+
3+
FROM node:$BASE_IMAGE_TAG
34

45
RUN apt-get update && \
56
apt-get install -y chromium firefox-esr xvfb libxi6 libgbm1 libgconf-2-4 openjdk-11-jre && \

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,26 @@ This image is published to Docker Hub and can be pulled via the command
2020
docker pull ppiper/node-browsers
2121
```
2222

23-
The default tag contains node 10 due to compatibility reasons with approuter.
23+
The default tag `latest` contains node 10 for compatibility reasons with approuter, which is a Maintenance LTS and will be end of life after 2021-04-30.
2424

25-
For node 12, use the tag `node12`:
25+
For node-12 or node-14, use the tag `12-buster` or `14-buster`:
2626

2727
```
28-
docker pull ppiper/node-browsers:node12
28+
docker pull ppiper/node-browsers:12-buster
29+
docker pull ppiper/node-browsers:14-buster
2930
```
3031

3132
## Build
3233

3334
To build this image locally, open a terminal in the directory of the Dockerfile and run
3435

3536
```
36-
docker build -t ppiper/node-browsers .
37+
docker build --build-arg=BASE_IMAGE_TAG=10-buster -t ppiper/node-browsers .
3738
```
3839

40+
Where the `BASE_IMAGE_TAG=10-buster` build argument can be replaced with `BASE_IMAGE_TAG=12-buster` or `BASE_IMAGE_TAG=14-buster`.
41+
The given tag **must** exist in the [node](https://hub.docker.com/_/node) base image **and** use Debian GNU/Linux.
42+
3943
## Usage
4044

4145
See this [blog post](https://blogs.sap.com/2017/12/11/sap-s4hana-cloud-sdk-end-to-end-tests-against-secured-applications/) for usage of this image in a Jenkins pipeline based on `ppiper/jenkins-master`.

node12/Dockerfile

Lines changed: 0 additions & 12 deletions
This file was deleted.

runTests.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#!/bin/bash -ex
22

3-
DOCKERFILE_PATH=${1:-.}
3+
TAG=${1:-.}
44

55
# Start a local registry, to which we push the images built in this test, and from which they will be consumed in the test
66
docker run -d -p 5000:5000 --restart always --name registry registry:2 || true
77

8-
docker build -t localhost:5000/ppiper/node-browsers:latest ${DOCKERFILE_PATH}
9-
docker tag localhost:5000/ppiper/node-browsers:latest ppiper/node-browsers:latest
8+
echo Testing version $TAG
9+
10+
docker build --build-arg=BASE_IMAGE_TAG=${TAG} -t localhost:5000/ppiper/node-browsers:latest .
1011
docker push localhost:5000/ppiper/node-browsers:latest
1112

1213
git clone https://github.com/piper-validation/cloud-s4-sdk-book.git -b validate-node-browsers test-project

0 commit comments

Comments
 (0)