From 6fe7fabfcbe14c1b39036e274414346951a3db96 Mon Sep 17 00:00:00 2001 From: Vlad Volkov Date: Wed, 17 May 2023 13:38:24 +0300 Subject: [PATCH 1/5] Update README.md --- README.md | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 44f124f..1c2bd6d 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,12 @@ # BN Digital Container Registry -## Contents +## Library -### Build - -#### NodeJS +### Yarn [Dockerfile](packages/yarn/Dockerfile) -This image used for assembling NodeJS-based applications. Includes Yarn 3 cached packages from `package.json` as [@bn-digital](https://github.com/bn-digital) technology stack foundation. - -### Runtime - -#### HTML +### NodeJS [Dockerfile](packages/nodejs/Dockerfile) @@ -20,18 +14,7 @@ This image used for assembling NodeJS-based applications. Includes Yarn 3 cached FROM nginx/unit:${unit_version}-minimal AS html ``` -#### NodeJS - -[Dockerfile](packages/nodejs/Dockerfile) - -```dockerfile -FROM node:${nodejs_version}-bullseye-slim AS nodejs -``` - -#### PHP +#### Docker in Docker -[Dockerfile](packages/nodejs/Dockerfile) +[Dockerfile](packages/dind/Dockerfile) -```dockerfile -FROM nginx/unit:${unit_version}-php${php_version} AS php -``` From bd46919c2956e5dfaa5fb2f9caffd11ade870217 Mon Sep 17 00:00:00 2001 From: Vlad Volkov Date: Wed, 17 May 2023 13:38:34 +0300 Subject: [PATCH 2/5] Update README.md --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 1c2bd6d..a2a7035 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,6 @@ [Dockerfile](packages/nodejs/Dockerfile) -```dockerfile -FROM nginx/unit:${unit_version}-minimal AS html -``` - #### Docker in Docker [Dockerfile](packages/dind/Dockerfile) From 73f09acaf32fac23c3a329bd21eec30b9c3a7c9b Mon Sep 17 00:00:00 2001 From: Vlad Volkov Date: Wed, 17 May 2023 13:40:05 +0300 Subject: [PATCH 3/5] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a2a7035..5df1e2f 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ ## Library +### Image layout and rules + ### Yarn [Dockerfile](packages/yarn/Dockerfile) From 583340e8b4a8344320a2616740d2991e72f6dae6 Mon Sep 17 00:00:00 2001 From: Vlad Volkov Date: Mon, 29 May 2023 13:31:01 +0300 Subject: [PATCH 4/5] Create build-pipelines.yml --- .github/workflows/build-pipelines.yml | 68 +++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/build-pipelines.yml diff --git a/.github/workflows/build-pipelines.yml b/.github/workflows/build-pipelines.yml new file mode 100644 index 0000000..4b04568 --- /dev/null +++ b/.github/workflows/build-pipelines.yml @@ -0,0 +1,68 @@ +on: + workflow_call: + inputs: + environment: + required: false + description: Used by Skaffold and Helmfile profiles + type: string + default: staging + env-template: + required: false + description: Env template file + type: string + default: "staging" + version: + required: false + description: Env template file + type: string + default: latest +env: + APP_NAME: ${{ github.event.repository.name }} + APP_ENV: ${{ inputs.environment }} + APP_VERSION: ${{ inputs.version }} +jobs: + docker: + runs-on: self-hosted + environment: ${{ inputs.environment }} + concurrency: + group: ${{ github.event.repository.name }}-docker-${{ github.ref_name }} + cancel-in-progress: true + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Generate cms .env files + uses: bn-digital/vault-env@latest + continue-on-error: true + with: + endpoint: ${{ secrets.VAULT_ENDPOINT }} + token: ${{ secrets.GH_TOKEN }} + template: packages/cms/.env.${{ env.APP_ENV }} + target: packages/cms/.env + + - name: Generate website .env files + uses: bn-digital/vault-env@latest + continue-on-error: true + with: + endpoint: ${{ secrets.VAULT_ENDPOINT }} + token: ${{ secrets.GH_TOKEN }} + template: packages/website/.env.${{ inputs.env-template }} + target: packages/website/.env.production + + - name: Login Docker registry + uses: docker/login-action@v2 + with: + registry: ${{ secrets.DOCKER_REGISTRY }}/${{ env.APP_NAME }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Install skaffold + uses: hiberbee/github-action-skaffold@1.27.0 + + - name: Build images + run: skaffold build + env: + SKAFFOLD_DEFAULT_REPO: ${{ secrets.DOCKER_REGISTRY }}/${{ env.APP_NAME }} + SKAFFOLD_TAG: ${{ env.APP_VERSION }} + SKAFFOLD_PUSH: true + SKAFFOLD_SKIP_TESTS: false From b0568aa11078dc1290978792f195e722d6b51d75 Mon Sep 17 00:00:00 2001 From: Vlad Volkov Date: Mon, 29 May 2023 14:13:24 +0300 Subject: [PATCH 5/5] Update build-pipelines.yml --- .github/workflows/build-pipelines.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-pipelines.yml b/.github/workflows/build-pipelines.yml index 4b04568..603da6e 100644 --- a/.github/workflows/build-pipelines.yml +++ b/.github/workflows/build-pipelines.yml @@ -24,6 +24,8 @@ jobs: docker: runs-on: self-hosted environment: ${{ inputs.environment }} + env: + DOCKER_REPOSITORY: dcr.bndigital.dev/${{ github.event.repository.name }} concurrency: group: ${{ github.event.repository.name }}-docker-${{ github.ref_name }} cancel-in-progress: true @@ -55,14 +57,13 @@ jobs: registry: ${{ secrets.DOCKER_REGISTRY }}/${{ env.APP_NAME }} username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - + - name: Install skaffold - uses: hiberbee/github-action-skaffold@1.27.0 + run: | + curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 + sudo install skaffold /usr/bin/ + curl -Lo container-structure-test https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64 + sudo install container-structure-test /usr/bin/ - name: Build images - run: skaffold build - env: - SKAFFOLD_DEFAULT_REPO: ${{ secrets.DOCKER_REGISTRY }}/${{ env.APP_NAME }} - SKAFFOLD_TAG: ${{ env.APP_VERSION }} - SKAFFOLD_PUSH: true - SKAFFOLD_SKIP_TESTS: false + run: skaffold build --default-repo=${{ env.DOCKER_REPOSITORY }} --tag=${{ inputs.version }}