diff --git a/.github/workflows/build-pipelines.yml b/.github/workflows/build-pipelines.yml new file mode 100644 index 0000000..603da6e --- /dev/null +++ b/.github/workflows/build-pipelines.yml @@ -0,0 +1,69 @@ +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 }} + env: + DOCKER_REPOSITORY: dcr.bndigital.dev/${{ github.event.repository.name }} + 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 + 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 --default-repo=${{ env.DOCKER_REPOSITORY }} --tag=${{ inputs.version }} diff --git a/README.md b/README.md index 44f124f..5df1e2f 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,18 @@ # BN Digital Container Registry -## Contents +## Library -### Build +### Image layout and rules -#### 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 - -[Dockerfile](packages/nodejs/Dockerfile) - -```dockerfile -FROM nginx/unit:${unit_version}-minimal AS html -``` - -#### NodeJS +### NodeJS [Dockerfile](packages/nodejs/Dockerfile) -```dockerfile -FROM node:${nodejs_version}-bullseye-slim AS nodejs -``` +#### Docker in Docker -#### PHP - -[Dockerfile](packages/nodejs/Dockerfile) +[Dockerfile](packages/dind/Dockerfile) -```dockerfile -FROM nginx/unit:${unit_version}-php${php_version} AS php -```