From 2e2221bfee92e905c17312a662388abaaff382c1 Mon Sep 17 00:00:00 2001 From: i3rotlher Date: Mon, 30 Oct 2023 14:41:22 +0100 Subject: [PATCH] docker update --- .../workflows/Build_and_Publish_Images.yaml | 85 +++---------------- backend/Dockerfile | 3 +- 2 files changed, 13 insertions(+), 75 deletions(-) diff --git a/.github/workflows/Build_and_Publish_Images.yaml b/.github/workflows/Build_and_Publish_Images.yaml index 13ce5a0b3..5ffc820c7 100644 --- a/.github/workflows/Build_and_Publish_Images.yaml +++ b/.github/workflows/Build_and_Publish_Images.yaml @@ -9,7 +9,6 @@ on: jobs: build-and-publish-release: runs-on: ubuntu-latest - if: startsWith(github.event.release.name, 'Seed-Test_v') steps: - name: Checkout Repository uses: actions/checkout@v2 @@ -41,7 +40,10 @@ jobs: - name: Push Docker Image to Docker Hub run: | docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-backend:${{ steps.get_tag_name.outputs.version }} - docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-backend:latest + + - name: Push Docker Image to Docker Hub as latest + if: ${{ startsWith(github.event.release.name, 'Seed-Test_v') }} + run: docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-backend:latest # FRONTEND - name: Build Docker Image @@ -55,7 +57,10 @@ jobs: - name: Push Docker Image to Docker Hub run: | docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-frontend:${{ steps.get_tag_name.outputs.version }} - docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-frontend:latest + + - name: Push Docker Image to Docker Hub as latest + if: ${{ startsWith(github.event.release.name, 'Seed-Test_v') }} + run: docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-frontend:latest # SINGLE QUICK DEMO CONTAINER - name: Build Docker Image as Latest @@ -70,7 +75,10 @@ jobs: - name: Push Docker Image to Docker Hub run: | docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-demo:${{ steps.get_tag_name.outputs.version }} - docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-demo:latest + + - name: Push Docker Image to Docker Hub as latest + if: ${{ startsWith(github.event.release.name, 'Seed-Test_v') }} + run: docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-demo:latest - name: Post susccess message uses: ./actions/notifyTeams @@ -88,72 +96,3 @@ jobs: text: "Publishing Images for release ${{ github.event.release.name }} failed." style: "failure" webhook: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} - - build-and-publish-test: - runs-on: ubuntu-latest - if: startsWith(github.event.release.name, 'Test_v') - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Install Dependencies - run: npm install node-fetch - - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Get Tag Name - id: get_tag_name - run: | - version=$(echo $GITHUB_REF | sed 's/refs\/tags\///') - echo "version=${version}" >> ${GITHUB_OUTPUT} - - # BACKEND - - name: Build Docker Image - run: | - docker build -t seed-test-backend:${{ steps.get_tag_name.outputs.version }} ./backend - docker tag seed-test-backend:${{ steps.get_tag_name.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/seed-test-backend:${{ steps.get_tag_name.outputs.version }} - - - name: Push Docker Image to Docker Hub - run: | - docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-backend:${{ steps.get_tag_name.outputs.version }} - - # FRONTEND - - name: Build Docker Image - run: | - docker build -t seed-test-frontend:${{ steps.get_tag_name.outputs.version }} ./frontend - docker tag seed-test-frontend:${{ steps.get_tag_name.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/seed-test-frontend:${{ steps.get_tag_name.outputs.version }} - - - name: Push Docker Image to Docker Hub - run: | - docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-frontend:${{ steps.get_tag_name.outputs.version }} - - # SINGLE QUICK DEMO CONTAINER - - name: Build Docker Image as Latest - run: | - docker build -t seed-test-demo:${{ steps.get_tag_name.outputs.version }} . - docker tag seed-test-demo:${{ steps.get_tag_name.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/seed-test-demo:${{ steps.get_tag_name.outputs.version }} - - - name: Push Docker Image to Docker Hub - run: | - docker push ${{ secrets.DOCKER_USERNAME }}/seed-test-demo:${{ steps.get_tag_name.outputs.version }} - - - name: Post susccess message - uses: ./actions/notifyTeams - with: - title: "Publish Test-Release DockerHub ๐Ÿงช๐Ÿณ๐ŸŒ" - text: "Publishing Images for test-release ${{ github.event.release.name }} successfully." - style: "success" - webhook: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} - - - name: Post error message - if: ${{ failure() }} - uses: ./actions/notifyTeams - with: - title: "Publish Test-Release DockerHub ๐Ÿณ๐ŸŒโŒ" - text: "Publishing Images for test-release ${{ github.event.release.name }} failed." - style: "failure" - webhook: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} diff --git a/backend/Dockerfile b/backend/Dockerfile index 042ec5225..ec3c36936 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -12,9 +12,8 @@ RUN yes | apt install ./google-chrome-stable_current_amd64.deb RUN rm -f google-chrome-stable_current_amd64.deb # install chromedriver -RUN google-chrome --version | grep -oP '\d+\.\d+\.\d+\.\d+' > chromeversion.txt RUN apt-get install -yqq unzip curl -RUN wget -O /tmp/chromedriverzip.zip https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$(cat chromeversion.txt)/linux64/chromedriver-linux64.zip +RUN wget -O /tmp/chromedriverzip.zip https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/$(curl https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_STABLE)/linux64/chromedriver-linux64.zip RUN unzip /tmp/chromedriverzip.zip chromedriver-linux64/chromedriver -d /usr/local/bin/ RUN mv /usr/local/bin/chromedriver-linux64/chromedriver /usr/local/bin/chromedriver