From 98dd5c52dace65be820c6ef417fc32bb01defb9a Mon Sep 17 00:00:00 2001 From: vovastelmashchuk Date: Thu, 7 Dec 2023 10:40:22 +0200 Subject: [PATCH 1/3] Fixed docker file and add ci for build docker images --- .github/workflows/build_image.yml | 37 +++++++++++++++++++++++++++++++ Dockerfile | 2 +- app/config_debug.json | 2 +- requirements.txt | 2 +- wsgi.py | 6 ----- 5 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/build_image.yml delete mode 100644 wsgi.py diff --git a/.github/workflows/build_image.yml b/.github/workflows/build_image.yml new file mode 100644 index 0000000..adeada9 --- /dev/null +++ b/.github/workflows/build_image.yml @@ -0,0 +1,37 @@ +name: Build Image Cross Platform + +on: + push: + branches: + - master + - fix_docker + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USER_NAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + - name: Available platforms + run: echo ${{ steps.buildx.outputs.platforms }} + + - name: Build and push + uses: docker/build-push-action@v2.7.0 + with: + context: ./ + file: ./Dockerfile + platforms: linux/arm64/v8, linux/arm64, linux/amd64 + push: true + tags: | + 0.1.9 diff --git a/Dockerfile b/Dockerfile index 650f0b1..215b53f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,6 @@ COPY requirements.txt /app RUN --mount=type=cache,target=/root/.cache/pip \ pip3 install -r requirements.txt -COPY . /app +COPY ./app /app CMD ["gunicorn", "--bind", "0.0.0.0:5000", "application:app"] \ No newline at end of file diff --git a/app/config_debug.json b/app/config_debug.json index d4a43d5..30ef320 100644 --- a/app/config_debug.json +++ b/app/config_debug.json @@ -18,7 +18,7 @@ "NOTIFIER": { "CURRENT_NOTIFIER": "SLACK", "SLACK_CHANNEL": "#prismo-debugxx", - "SLACK_TOKEN": "xoxb-10631168368-6285659487555-mlu3mtOsfnSI74TNS4JOjBvg" + "SLACK_TOKEN": "xoxb-156594252659-6059712941424-f2Ot4xppyE5wvLs1RtgGPj0N" } } } \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 6a098fa..b4d5d4a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,5 +10,5 @@ pylint pycodestyle gunicorn==20.0.4 argon2-cffi -pyee +pyee~=11.1.0 slack-bolt diff --git a/wsgi.py b/wsgi.py deleted file mode 100644 index 37e1e82..0000000 --- a/wsgi.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -from application import app - -if __name__ == "__main__": - app.run(host='0.0.0.0', port=os.environ.get("FLASK_SERVER_PORT"), debug=True) From 98b570012e5cb20137b9a45e50582b4e4e463834 Mon Sep 17 00:00:00 2001 From: vovastelmashchuk Date: Thu, 7 Dec 2023 10:43:15 +0200 Subject: [PATCH 2/3] change to correct tag --- .github/workflows/build_image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_image.yml b/.github/workflows/build_image.yml index adeada9..1c9d2cf 100644 --- a/.github/workflows/build_image.yml +++ b/.github/workflows/build_image.yml @@ -34,4 +34,4 @@ jobs: platforms: linux/arm64/v8, linux/arm64, linux/amd64 push: true tags: | - 0.1.9 + hacklabkyiv/prismo-app:0.1.9 From 41205589673cdbc75a8076e06561e70621405ca5 Mon Sep 17 00:00:00 2001 From: vovastelmashchuk Date: Thu, 7 Dec 2023 11:36:07 +0200 Subject: [PATCH 3/3] Implement build docker image with correct tags --- .github/workflows/build_image.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_image.yml b/.github/workflows/build_image.yml index 1c9d2cf..b497b32 100644 --- a/.github/workflows/build_image.yml +++ b/.github/workflows/build_image.yml @@ -1,10 +1,15 @@ name: Build Image Cross Platform on: + workflow_dispatch: push: branches: - - master - - fix_docker + - 'master' + tags: + - '*' + pull_request: + branches: + - 'master' jobs: build: @@ -15,6 +20,12 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v1 + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: hacklabkyiv/prismo-app + - name: Login to GitHub Container Registry uses: docker/login-action@v1 with: @@ -31,7 +42,6 @@ jobs: with: context: ./ file: ./Dockerfile - platforms: linux/arm64/v8, linux/arm64, linux/amd64 + platforms: linux/arm64/v8 push: true - tags: | - hacklabkyiv/prismo-app:0.1.9 + tags: ${{ steps.meta.outputs.tags }}