From bb62393e5149e243a94b637957845928b3debe3e Mon Sep 17 00:00:00 2001 From: rbgodwin Date: Sat, 22 Apr 2023 07:37:30 +0400 Subject: [PATCH 1/2] Add in shallow clone of git so version is available. Add docker tags for commit and branches --- .github/workflows/deploy.yml | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bb7335d5..d39f53b9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,32 +4,51 @@ on: push: branches: - - main - - master - - deploy-action + - main + - master + - dev + - deploy-action jobs: build: runs-on: ubuntu-latest steps: + - name: Checkout Repo + uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ${{ secrets.DOCKER_USERNAME }}/nmos-testing + tags: | + # Tag all builds with branch name and sha + type=sha,prefix=${{ github.ref_name }}- + # Tag each non-default branch with branch name and latest + type=raw,value=latest,prefix=${{ github.ref_name }}-,enable=${{ github.ref_name != 'master' }} + # Tag default branch with latest (no branch name prefix) + type=raw,value=latest,enable={{is_default_branch}} + - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2.1.0 with: platforms: all - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2.5.0 - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v2.1.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v4.0.0 with: + context: . builder: ${{ steps.buildx.outputs.name }} platforms: linux/amd64,linux/arm64 push: true - tags: ${{ secrets.DOCKER_USERNAME }}/nmos-testing:latest + tags: ${{ steps.meta.outputs.tags }} From 12f1b053da339606eb98c67dae8106edde585e9f Mon Sep 17 00:00:00 2001 From: rbgodwin Date: Sat, 22 Apr 2023 07:53:31 +0400 Subject: [PATCH 2/2] Put git directory on docker image for version and ease of development --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 38db0fa2..08fcfef8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ FROM ubuntu:bionic WORKDIR /home/nmos-testing ADD . . +ADD .git .git RUN apt-get update \ && export DEBIAN_FRONTEND=noninteractive \