From 4da115865253444dd5f8d1ffdeca447c9548088c Mon Sep 17 00:00:00 2001 From: Dmitry Kuksinsky Date: Wed, 3 Apr 2024 13:23:29 +0400 Subject: [PATCH] #67 gh action to build demo image --- .dockerignore | 9 ++++---- .github/workflows/docker.yml | 43 ++++++++++++++++++++++++++++++++++++ requirements.txt | 2 +- 3 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/docker.yml diff --git a/.dockerignore b/.dockerignore index 2dd3e3a4..1343350b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,9 +1,10 @@ * +!business_logic +!docs/requirements.txt +!manage.py +!README.* !requirements.* !setup.* -!tests !sites -!business_logic -!README.* -!manage.py +!tests sites/dev/db.sqlite3 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..ebdcfa9b --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,43 @@ +name: build docker demo image + +on: + push: + branches: + - feature/gh-docker-build + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - id: build-args + run: | + echo VCS_REF=`git rev-parse --short HEAD` >> $GITHUB_OUTPUT + echo BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` >> $GITHUB_OUTPUT + echo VERSION=`python -c 'from __future__ import print_function; import business_logic; print(business_logic.__version__)'` >> $GITHUB_OUTPUT + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + build-args: | + VCS_REF=${{ steps.build-args.outputs.VCS_REF }} + BUILD_DATE=${{ steps.build-args.outputs.BUILD_DATE }} + VERSION=${{ steps.build-args.outputs.VERSION }} + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: dgksu/django-business-logic:demox diff --git a/requirements.txt b/requirements.txt index f070158f..3f0c5755 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,5 +5,5 @@ django-filter==23.2 django-nested-admin==4.0.2 django-polymorphic==3.1.0 django-treebeard==4.7 -djangorestframework>=3.14.0 +djangorestframework>=3.14.0,<3.15.0 lxml<5.0