From 9026c7485bdd981287dce1a029cc55983362ab80 Mon Sep 17 00:00:00 2001 From: Pilou <60597222+PierreLouisF@users.noreply.github.com> Date: Mon, 16 Jan 2023 17:16:53 +0100 Subject: [PATCH 01/32] Create docker-image.yml --- .github/workflows/docker-image.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 00000000..d657a63b --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,18 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) From 08a50e950523877a1120b112c41d01e726b064af Mon Sep 17 00:00:00 2001 From: sebastiendelestret Date: Mon, 6 Feb 2023 14:36:14 +0100 Subject: [PATCH 02/32] Create build-docker-image.yml --- .github/workflows/build-docker-image.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/build-docker-image.yml diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml new file mode 100644 index 00000000..e9f408c4 --- /dev/null +++ b/.github/workflows/build-docker-image.yml @@ -0,0 +1,21 @@ +name: Build Docker Image + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build Docker Image + uses: docker/build-push-action@v2 + with: + push: false + tags: pw-jwt-oauth + context: ../pw/pw-jwt-oauth/server/src/main/docker From 17cb78aa5aac7ffc7ac1b9e09cad91215583e5ec Mon Sep 17 00:00:00 2001 From: sebastiendelestret Date: Mon, 6 Feb 2023 14:44:19 +0100 Subject: [PATCH 03/32] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index e9f408c4..f032a133 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -10,12 +10,6 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Build Docker Image - uses: docker/build-push-action@v2 - with: - push: false - tags: pw-jwt-oauth - context: ../pw/pw-jwt-oauth/server/src/main/docker + - name: Checkout code + uses: actions/checkout@v2 + run: docker build . --file pw/pw-jwt-oauth/server/src/main/docker/Dockerfile --tag pw-jwt-oauth:$(date +%s) \ No newline at end of file From 4336b5e9f7192fe871f7a9661d8c98e72a6e8aa6 Mon Sep 17 00:00:00 2001 From: sebastiendelestret Date: Mon, 6 Feb 2023 14:58:43 +0100 Subject: [PATCH 04/32] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index f032a133..d38050de 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -10,6 +10,6 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 - run: docker build . --file pw/pw-jwt-oauth/server/src/main/docker/Dockerfile --tag pw-jwt-oauth:$(date +%s) \ No newline at end of file + - uses: actions/checkout@v2 + - name: Build the docker image + run: docker build . --file pw/pw-jwt-oauth/server/src/main/docker/Dockerfile --tag pw-jwt-oauth:$(date +%s) \ No newline at end of file From 3874971d0b7fbc30b16d4746a80644eee005c440 Mon Sep 17 00:00:00 2001 From: Pilou <60597222+PierreLouisF@users.noreply.github.com> Date: Mon, 6 Feb 2023 15:05:26 +0100 Subject: [PATCH 05/32] testPierreLouisDockerIMG --- .github/workflows/dockerImgDeploy.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/dockerImgDeploy.yml diff --git a/.github/workflows/dockerImgDeploy.yml b/.github/workflows/dockerImgDeploy.yml new file mode 100644 index 00000000..d657a63b --- /dev/null +++ b/.github/workflows/dockerImgDeploy.yml @@ -0,0 +1,18 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) From 718b5a089fa5cf05c30cacb8154199d3befec991 Mon Sep 17 00:00:00 2001 From: sebastiendelestret Date: Mon, 6 Feb 2023 15:08:12 +0100 Subject: [PATCH 06/32] Update Dockerfile --- pw/pw-jwt-oauth/server/src/main/docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pw/pw-jwt-oauth/server/src/main/docker/Dockerfile b/pw/pw-jwt-oauth/server/src/main/docker/Dockerfile index 66991b29..b6dfe1da 100644 --- a/pw/pw-jwt-oauth/server/src/main/docker/Dockerfile +++ b/pw/pw-jwt-oauth/server/src/main/docker/Dockerfile @@ -4,7 +4,7 @@ ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \ JHIPSTER_SLEEP=0 # add directly the war -ADD *.war /app.war +#ADD *.war /app.war VOLUME /tmp EXPOSE 8080 From a2052908ee41abed811078ef313ea5cd89fdc741 Mon Sep 17 00:00:00 2001 From: Pilou <60597222+PierreLouisF@users.noreply.github.com> Date: Mon, 6 Feb 2023 15:08:14 +0100 Subject: [PATCH 07/32] TestPush --- .github/workflows/13_PL_SD/Dockerfile | 32 +++++++++++++++++++++++++++ .github/workflows/dockerImgDeploy.yml | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/13_PL_SD/Dockerfile diff --git a/.github/workflows/13_PL_SD/Dockerfile b/.github/workflows/13_PL_SD/Dockerfile new file mode 100644 index 00000000..5ee8c11a --- /dev/null +++ b/.github/workflows/13_PL_SD/Dockerfile @@ -0,0 +1,32 @@ +# +# Ubuntu Dockerfile +# +# https://github.com/dockerfile/ubuntu +# + +# Pull base image. +FROM ubuntu:latest + +# Install. +RUN \ + sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \ + apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y build-essential && \ + apt-get install -y software-properties-common && \ + apt-get install -y byobu curl git htop man unzip vim wget && \ + rm -rf /var/lib/apt/lists/* + +# Add files. +ADD root/.bashrc /root/.bashrc +ADD root/.gitconfig /root/.gitconfig +ADD root/.scripts /root/.scripts + +# Set environment variables. +ENV HOME /root + +# Define working directory. +WORKDIR /root + +# Define default command. +ENTRYPOINT ["bash"] diff --git a/.github/workflows/dockerImgDeploy.yml b/.github/workflows/dockerImgDeploy.yml index d657a63b..e5b81f9c 100644 --- a/.github/workflows/dockerImgDeploy.yml +++ b/.github/workflows/dockerImgDeploy.yml @@ -15,4 +15,4 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build the Docker image - run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) + run: docker build . --file ./13_PL_SD/Dockerfile --tag my-image-name:$(date +%s) From 0596a43700cf04e5a870028920cd28b8ed2fad82 Mon Sep 17 00:00:00 2001 From: sebastiendelestret Date: Mon, 6 Feb 2023 15:16:08 +0100 Subject: [PATCH 08/32] clean files and update build-docker-image --- .github/workflows/13_PL_SD/Dockerfile | 32 ------------------------ .github/workflows/build-docker-image.yml | 15 ++++++----- .github/workflows/docker-image.yml | 18 ------------- .github/workflows/dockerImgDeploy.yml | 18 ------------- docker/Dockerfile | 17 +++++++++++++ 5 files changed, 26 insertions(+), 74 deletions(-) delete mode 100644 .github/workflows/13_PL_SD/Dockerfile delete mode 100644 .github/workflows/docker-image.yml delete mode 100644 .github/workflows/dockerImgDeploy.yml create mode 100644 docker/Dockerfile diff --git a/.github/workflows/13_PL_SD/Dockerfile b/.github/workflows/13_PL_SD/Dockerfile deleted file mode 100644 index 5ee8c11a..00000000 --- a/.github/workflows/13_PL_SD/Dockerfile +++ /dev/null @@ -1,32 +0,0 @@ -# -# Ubuntu Dockerfile -# -# https://github.com/dockerfile/ubuntu -# - -# Pull base image. -FROM ubuntu:latest - -# Install. -RUN \ - sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y build-essential && \ - apt-get install -y software-properties-common && \ - apt-get install -y byobu curl git htop man unzip vim wget && \ - rm -rf /var/lib/apt/lists/* - -# Add files. -ADD root/.bashrc /root/.bashrc -ADD root/.gitconfig /root/.gitconfig -ADD root/.scripts /root/.scripts - -# Set environment variables. -ENV HOME /root - -# Define working directory. -WORKDIR /root - -# Define default command. -ENTRYPOINT ["bash"] diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index d38050de..8b39fe16 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -1,15 +1,18 @@ -name: Build Docker Image +name: Docker Image CI on: push: - branches: - - main + branches: [ "main" ] + pull_request: + branches: [ "main" ] jobs: + build: + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Build the docker image - run: docker build . --file pw/pw-jwt-oauth/server/src/main/docker/Dockerfile --tag pw-jwt-oauth:$(date +%s) \ No newline at end of file + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --file ./docker/Dockerfile --tag my-image-name:$(date +%s) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index d657a63b..00000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Docker Image CI - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) diff --git a/.github/workflows/dockerImgDeploy.yml b/.github/workflows/dockerImgDeploy.yml deleted file mode 100644 index e5b81f9c..00000000 --- a/.github/workflows/dockerImgDeploy.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Docker Image CI - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Build the Docker image - run: docker build . --file ./13_PL_SD/Dockerfile --tag my-image-name:$(date +%s) diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..ef36ff85 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,17 @@ +# +# Ubuntu Dockerfile +# +# https://github.com/dockerfile/ubuntu +# + +# Pull base image. +FROM ubuntu:latest + +# Set environment variables. +ENV HOME /root + +# Define working directory. +WORKDIR /root + +# Define default command. +ENTRYPOINT ["bash"] From c0f247f6df8e38503a51fa7760890f9ad5de7cd3 Mon Sep 17 00:00:00 2001 From: sebastiendelestret Date: Mon, 6 Feb 2023 15:31:46 +0100 Subject: [PATCH 09/32] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 8b39fe16..3c2f3372 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [ "main" ] +env: + IMAGE_NAME: my-image-name:$(date +%s) + jobs: build: @@ -14,5 +17,13 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Build the Docker image - run: docker build . --file ./docker/Dockerfile --tag my-image-name:$(date +%s) + run: docker build . --file ./docker/Dockerfile --tag ${{ env.IMAGE_NAME }} + + - name: Runs dockle + uses: hands-lab/dockle-action@v1 + with: + image: ${{ env.IMAGE_NAME }} + + From f930f57f767a08798cc43a72395f5b0a89577372 Mon Sep 17 00:00:00 2001 From: sebastiendelestret Date: Mon, 6 Feb 2023 15:35:54 +0100 Subject: [PATCH 10/32] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 3c2f3372..0bf7522f 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -7,7 +7,7 @@ on: branches: [ "main" ] env: - IMAGE_NAME: my-image-name:$(date +%s) + IMAGE_NAME: my-docker-image jobs: @@ -25,5 +25,6 @@ jobs: uses: hands-lab/dockle-action@v1 with: image: ${{ env.IMAGE_NAME }} + exit-level: FATAL From 1b3ea7f4513675492bc07550bfe2d2d33157ee7e Mon Sep 17 00:00:00 2001 From: sebastiendelestret Date: Mon, 6 Feb 2023 15:42:44 +0100 Subject: [PATCH 11/32] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 0bf7522f..8c1ed814 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -26,5 +26,6 @@ jobs: with: image: ${{ env.IMAGE_NAME }} exit-level: FATAL + exit-code: '0' From 667b8670f405bee5c6d078c82a5071ef89e432a6 Mon Sep 17 00:00:00 2001 From: Pilou <60597222+PierreLouisF@users.noreply.github.com> Date: Mon, 6 Feb 2023 15:46:38 +0100 Subject: [PATCH 12/32] deploy img to DockerHub --- .github/workflows/build-docker-image.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 8c1ed814..338a9d76 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -27,5 +27,23 @@ jobs: image: ${{ env.IMAGE_NAME }} exit-level: FATAL exit-code: '0' - - + + - name: Log in to Docker Hub + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: docker/my-image-name:$(date +%s) + + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file From 94762bc197f2ee5bc6cb1c38d455661cebdbcb50 Mon Sep 17 00:00:00 2001 From: Pilou <60597222+PierreLouisF@users.noreply.github.com> Date: Mon, 6 Feb 2023 15:50:01 +0100 Subject: [PATCH 13/32] deploy image to dockerHub v2 --- .github/workflows/build-docker-image.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 338a9d76..20f74366 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -29,19 +29,19 @@ jobs: exit-code: '0' - name: Log in to Docker Hub - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + uses: docker/login-action@v2.1.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + uses: docker/metadata-action@v4.3.0 with: images: docker/my-image-name:$(date +%s) - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + uses: docker/build-push-action@v4.0.0 with: context: . push: true From c068529b5e19bad07b0471b15bd402fe8564f46f Mon Sep 17 00:00:00 2001 From: Pilou <60597222+PierreLouisF@users.noreply.github.com> Date: Mon, 6 Feb 2023 15:51:48 +0100 Subject: [PATCH 14/32] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 32 ++++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 20f74366..7d17d5ee 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -29,21 +29,21 @@ jobs: exit-code: '0' - name: Log in to Docker Hub - uses: docker/login-action@v2.1.0 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + uses: docker/login-action@v2.1.0 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4.3.0 - with: - images: docker/my-image-name:$(date +%s) + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4.3.0 + with: + images: docker/my-image-name:$(date +%s) - - name: Build and push Docker image - uses: docker/build-push-action@v4.0.0 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + - name: Build and push Docker image + uses: docker/build-push-action@v4.0.0 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file From 341a5eced5816393bb5c927e5ac63af12027ecb5 Mon Sep 17 00:00:00 2001 From: Pilou <60597222+PierreLouisF@users.noreply.github.com> Date: Mon, 6 Feb 2023 15:56:36 +0100 Subject: [PATCH 15/32] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 7d17d5ee..11bc195f 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -13,7 +13,7 @@ jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From ece83647b7b692799f165f8b30c309698dca703a Mon Sep 17 00:00:00 2001 From: Pilou <60597222+PierreLouisF@users.noreply.github.com> Date: Mon, 6 Feb 2023 16:03:40 +0100 Subject: [PATCH 16/32] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 11bc195f..4ca50d74 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -38,7 +38,7 @@ jobs: id: meta uses: docker/metadata-action@v4.3.0 with: - images: docker/my-image-name:$(date +%s) + images: ${{ secrets.DOCKER_USERNAME }}/tp_gr11_pl_seb - name: Build and push Docker image uses: docker/build-push-action@v4.0.0 From 5777f82ff6122961fda1c378d68fe6254e99d378 Mon Sep 17 00:00:00 2001 From: Pilou <60597222+PierreLouisF@users.noreply.github.com> Date: Mon, 6 Feb 2023 16:05:18 +0100 Subject: [PATCH 17/32] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 4ca50d74..9df45bcb 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -43,7 +43,7 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v4.0.0 with: - context: . + context: ${{ env.IMAGE_NAME }} push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file From e23a286cd7c7d517050a66b77d44c13ce90a37eb Mon Sep 17 00:00:00 2001 From: sebastiendelestret Date: Mon, 6 Feb 2023 16:12:38 +0100 Subject: [PATCH 18/32] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 9df45bcb..2149df4d 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -43,7 +43,7 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v4.0.0 with: - context: ${{ env.IMAGE_NAME }} + context: ./docker/Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file From 4e9e2bebbc1e5817bd79aab4fa3c8ef540f875c1 Mon Sep 17 00:00:00 2001 From: sebastiendelestret Date: Mon, 6 Feb 2023 16:15:38 +0100 Subject: [PATCH 19/32] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 2149df4d..b255fce1 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -43,7 +43,7 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v4.0.0 with: - context: ./docker/Dockerfile + context: ./docker/ push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file From 0089398d1f695ce81304ba56f099c1b083c25122 Mon Sep 17 00:00:00 2001 From: sebastiendelestret Date: Mon, 6 Feb 2023 16:39:48 +0100 Subject: [PATCH 20/32] add condition stop workflow on FATAL vulnerability --- .github/workflows/build-docker-image.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index b255fce1..a23e83c5 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -22,11 +22,16 @@ jobs: run: docker build . --file ./docker/Dockerfile --tag ${{ env.IMAGE_NAME }} - name: Runs dockle + id: dockle_check uses: hands-lab/dockle-action@v1 with: image: ${{ env.IMAGE_NAME }} exit-level: FATAL - exit-code: '0' + exit-code: '1' + + - name: Stop workflow if FATAL vulnerability detected + if: steps.dockle_check.outputs.exit_code == 1 + run: exit ${{ steps.dockle_check.outputs.exit_code }} - name: Log in to Docker Hub uses: docker/login-action@v2.1.0 From f1cd8ee596d0e04284cd57e282c9b153d290dde4 Mon Sep 17 00:00:00 2001 From: sebastiendelestret Date: Mon, 6 Feb 2023 17:03:29 +0100 Subject: [PATCH 21/32] Update Dockerfile --- docker/Dockerfile | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index ef36ff85..ec00fe2a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,17 +1,22 @@ -# -# Ubuntu Dockerfile -# -# https://github.com/dockerfile/ubuntu -# +# Use the latest version of the Alpine Linux image as the base image +FROM node:latest -# Pull base image. -FROM ubuntu:latest +# Set environment variables for the non-root user +ENV HOME /home/node +ENV NODE_USER node +ENV UID 1000 -# Set environment variables. -ENV HOME /root +# Create a non-root user with a specified UID +RUN adduser -u $UID $NODE_USER -# Define working directory. -WORKDIR /root +# Set the working directory to the non-root user's home directory +WORKDIR $HOME -# Define default command. -ENTRYPOINT ["bash"] +# Set the user for subsequent commands to the non-root user +USER $NODE_USER + +# Install the latest version of npm +RUN npm install -g npm@latest + +# Set the default command to run when the container starts +CMD ["node"] From 06f014bc2ceb7eae4b27a4c3610bfca5b34aeb0d Mon Sep 17 00:00:00 2001 From: sebastiendelestret <58606253+sebastiendelestret@users.noreply.github.com> Date: Sun, 12 Feb 2023 12:18:40 +0100 Subject: [PATCH 22/32] Update Dockerfile --- docker/Dockerfile | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index ec00fe2a..6993762d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,22 +1,17 @@ -# Use the latest version of the Alpine Linux image as the base image -FROM node:latest +# Use an official Ubuntu image as the base image +FROM ubuntu:20.04 -# Set environment variables for the non-root user -ENV HOME /home/node -ENV NODE_USER node -ENV UID 1000 +# Update the package list and upgrade the installed packages +RUN apt-get update && apt-get upgrade -y -# Create a non-root user with a specified UID -RUN adduser -u $UID $NODE_USER +# Install the necessary packages +RUN apt-get install -y nano curl wget -# Set the working directory to the non-root user's home directory -WORKDIR $HOME +# Set the working directory +WORKDIR /app -# Set the user for subsequent commands to the non-root user -USER $NODE_USER +# Copy the application code to the working directory +COPY . . -# Install the latest version of npm -RUN npm install -g npm@latest - -# Set the default command to run when the container starts -CMD ["node"] +# Specify the command to run when the container starts +CMD [ "/bin/bash" ] From eb790564e4c4cc5af4f5401d20d598832aeb3508 Mon Sep 17 00:00:00 2001 From: sebastiendelestret <58606253+sebastiendelestret@users.noreply.github.com> Date: Sun, 12 Feb 2023 16:32:23 +0100 Subject: [PATCH 23/32] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 31 ++++++++++++++---------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index a23e83c5..6395abf9 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -18,20 +18,25 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Build the Docker image - run: docker build . --file ./docker/Dockerfile --tag ${{ env.IMAGE_NAME }} - - - name: Runs dockle - id: dockle_check - uses: hands-lab/dockle-action@v1 + # - name: Build the Docker image + # run: docker build . --file ./docker/Dockerfile --tag ${{ env.IMAGE_NAME }} + + # - name: Runs dockle + # id: dockle_check + # uses: hands-lab/dockle-action@v1 + # with: + # image: ${{ env.IMAGE_NAME }} + # exit-level: FATAL + # exit-code: '1' + + # - name: Stop workflow if FATAL vulnerability detected + # if: steps.dockle_check.outputs.exit_code == 1 + # run: exit ${{ steps.dockle_check.outputs.exit_code }} + + - name: lint + uses: luke142367/Docker-Lint-Action@v1.0.0 with: - image: ${{ env.IMAGE_NAME }} - exit-level: FATAL - exit-code: '1' - - - name: Stop workflow if FATAL vulnerability detected - if: steps.dockle_check.outputs.exit_code == 1 - run: exit ${{ steps.dockle_check.outputs.exit_code }} + target: ./docker/Dockerfile - name: Log in to Docker Hub uses: docker/login-action@v2.1.0 From 10284a06216580ebca6152e7207690c397e07676 Mon Sep 17 00:00:00 2001 From: sebastiendelestret <58606253+sebastiendelestret@users.noreply.github.com> Date: Sun, 12 Feb 2023 16:34:37 +0100 Subject: [PATCH 24/32] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 6395abf9..5f3dbcd3 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -33,8 +33,8 @@ jobs: # if: steps.dockle_check.outputs.exit_code == 1 # run: exit ${{ steps.dockle_check.outputs.exit_code }} - - name: lint - uses: luke142367/Docker-Lint-Action@v1.0.0 + - name: Docker Lint + uses: luke142367/Docker-Lint-Action@v1.1.1 with: target: ./docker/Dockerfile From 02e9e80b82f4287776e5bc7100e405f2a27d04d0 Mon Sep 17 00:00:00 2001 From: sebastiendelestret <58606253+sebastiendelestret@users.noreply.github.com> Date: Sun, 12 Feb 2023 16:39:45 +0100 Subject: [PATCH 25/32] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 5f3dbcd3..2131a3de 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -37,6 +37,8 @@ jobs: uses: luke142367/Docker-Lint-Action@v1.1.1 with: target: ./docker/Dockerfile + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Log in to Docker Hub uses: docker/login-action@v2.1.0 From 527f9e07cd3a42d6a0b0df24cf6364feb37afa63 Mon Sep 17 00:00:00 2001 From: sebastiendelestret <58606253+sebastiendelestret@users.noreply.github.com> Date: Sun, 12 Feb 2023 16:46:07 +0100 Subject: [PATCH 26/32] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 2131a3de..9bca7161 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -34,11 +34,9 @@ jobs: # run: exit ${{ steps.dockle_check.outputs.exit_code }} - name: Docker Lint - uses: luke142367/Docker-Lint-Action@v1.1.1 + uses: hadolint/hadolint-action@v3.1.0 with: - target: ./docker/Dockerfile - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + dockerfile: Dockerfile - name: Log in to Docker Hub uses: docker/login-action@v2.1.0 From 85806a3325baffa603634fc9f3ac1d142e59283e Mon Sep 17 00:00:00 2001 From: sebastiendelestret <58606253+sebastiendelestret@users.noreply.github.com> Date: Sun, 12 Feb 2023 16:49:34 +0100 Subject: [PATCH 27/32] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 9bca7161..5cd0b27e 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -36,7 +36,7 @@ jobs: - name: Docker Lint uses: hadolint/hadolint-action@v3.1.0 with: - dockerfile: Dockerfile + dockerfile: ./docker/Dockerfile - name: Log in to Docker Hub uses: docker/login-action@v2.1.0 From bb445de0c7b8c0454d5613b6ee595b470c39d591 Mon Sep 17 00:00:00 2001 From: sebastiendelestret <58606253+sebastiendelestret@users.noreply.github.com> Date: Mon, 13 Feb 2023 12:41:07 +0100 Subject: [PATCH 28/32] dockerfile corrections based on linter recommendations --- .github/workflows/build-docker-image.yml | 1 + docker/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 5cd0b27e..390c68b4 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -37,6 +37,7 @@ jobs: uses: hadolint/hadolint-action@v3.1.0 with: dockerfile: ./docker/Dockerfile + failure-threshold : warning - name: Log in to Docker Hub uses: docker/login-action@v2.1.0 diff --git a/docker/Dockerfile b/docker/Dockerfile index 6993762d..ca25ab1b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,7 +5,7 @@ FROM ubuntu:20.04 RUN apt-get update && apt-get upgrade -y # Install the necessary packages -RUN apt-get install -y nano curl wget +RUN apt-get install -y nano=7.2 curl=7.87.0 # Set the working directory WORKDIR /app From 50b8b699b1ddf9cb4e39de9a59957bc781906bc5 Mon Sep 17 00:00:00 2001 From: sebastiendelestret <58606253+sebastiendelestret@users.noreply.github.com> Date: Mon, 13 Feb 2023 12:54:23 +0100 Subject: [PATCH 29/32] Update Dockerfile --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index ca25ab1b..c6007cf8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,7 +5,7 @@ FROM ubuntu:20.04 RUN apt-get update && apt-get upgrade -y # Install the necessary packages -RUN apt-get install -y nano=7.2 curl=7.87.0 +RUN apt-get install -y nano=4.8-1ubuntu1 # Set the working directory WORKDIR /app From 889d57b90f8876ad22fd9a9839728849b4665b43 Mon Sep 17 00:00:00 2001 From: sebastiendelestret <58606253+sebastiendelestret@users.noreply.github.com> Date: Mon, 13 Feb 2023 15:24:19 +0100 Subject: [PATCH 30/32] Update build-docker-image.yml --- .github/workflows/build-docker-image.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 390c68b4..35219d1d 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -18,21 +18,6 @@ jobs: steps: - uses: actions/checkout@v3 - # - name: Build the Docker image - # run: docker build . --file ./docker/Dockerfile --tag ${{ env.IMAGE_NAME }} - - # - name: Runs dockle - # id: dockle_check - # uses: hands-lab/dockle-action@v1 - # with: - # image: ${{ env.IMAGE_NAME }} - # exit-level: FATAL - # exit-code: '1' - - # - name: Stop workflow if FATAL vulnerability detected - # if: steps.dockle_check.outputs.exit_code == 1 - # run: exit ${{ steps.dockle_check.outputs.exit_code }} - - name: Docker Lint uses: hadolint/hadolint-action@v3.1.0 with: From 9773b13c3731ea9b7ab1c7721dcbcfd7c2736cc4 Mon Sep 17 00:00:00 2001 From: sebastiendelestret <58606253+sebastiendelestret@users.noreply.github.com> Date: Wed, 15 Feb 2023 11:22:34 +0100 Subject: [PATCH 31/32] =?UTF-8?q?Dockerfile=20vuln=C3=A9rable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index c6007cf8..f23571ab 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,7 +5,7 @@ FROM ubuntu:20.04 RUN apt-get update && apt-get upgrade -y # Install the necessary packages -RUN apt-get install -y nano=4.8-1ubuntu1 +RUN apt-get install -y nano # Set the working directory WORKDIR /app From 9166c8bbabf21891adf4ab4546f7e037804cfc5f Mon Sep 17 00:00:00 2001 From: sebastiendelestret <58606253+sebastiendelestret@users.noreply.github.com> Date: Wed, 15 Feb 2023 11:23:07 +0100 Subject: [PATCH 32/32] =?UTF-8?q?Dockerfile=20corrig=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index f23571ab..c6007cf8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,7 +5,7 @@ FROM ubuntu:20.04 RUN apt-get update && apt-get upgrade -y # Install the necessary packages -RUN apt-get install -y nano +RUN apt-get install -y nano=4.8-1ubuntu1 # Set the working directory WORKDIR /app