From 7aa6b80287fb36f9b01114cf41fcec978e5df554 Mon Sep 17 00:00:00 2001 From: Dario Date: Sat, 9 Mar 2024 11:12:13 +0100 Subject: [PATCH 1/5] fix: new dockerfile --- .github/workflows/release.yml | 21 ++++++--------------- docker-compose.yml | 5 +++-- webapp/Dockerfile | 3 --- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7f74898c..c4dd1406 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ on: types: [published] push: branches: - - master + - fix/actions jobs: docker-push-api: @@ -15,7 +15,6 @@ jobs: - name: Publish to Registry uses: elgohr/Publish-Docker-Github-Action@v5 env: - API_URI: http://${{ secrets.DEPLOY_HOST }}:8080 DATABASE_USER: ${{ secrets.DATABASE_USER }} DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }} JWT_SECRET: ${{ secrets.JWT_SECRET }} @@ -36,7 +35,7 @@ jobs: - name: Publish to Registry uses: elgohr/Publish-Docker-Github-Action@v5 env: - API_URI: ${{ secrets.DEPLOY_HOST }} + API_URI: http://${{ secrets.DEPLOY_HOST }}:8080 teamname: wiq_en2b with: name: arquisoft/wiq_en2b/webapp @@ -62,15 +61,7 @@ jobs: user: ${{ secrets.DEPLOY_USER }} key: ${{ secrets.DEPLOY_KEY }} command: | - git clone https://github.com/Arquisoft/wiq_en2b.git - git pull - cd wiq_en2b - echo "DATABASE_USER=${{ secrets.DATABASE_USER }}" >> .env - echo "DATABASE_PASSWORD=${{ secrets.DATABASE_PASSWORD }}" >> .env - echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env - echo "API_URI=http://${{ secrets.DEPLOY_HOST }}:8080" >> .env - sudo docker compose down - sudo docker compose pull - sudo docker compose --profile prod up -d - cd ../ - rm -r wiq_en2b --force + wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/docker-compose.yml -O docker-compose.yml + wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/.env + docker compose down + docker compose --profile prod up -d diff --git a/docker-compose.yml b/docker-compose.yml index 7bf758fe..2f52fd15 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,10 +33,11 @@ services: container_name: webapp-${teamname:-defaultASW} image: webapp:latest profiles: [ "dev", "prod" ] + build: context: ./webapp - args: - API_URI: http://${API_URI}:8080 + environment: + - REACT_APP_API_ENDPOINT=${API_URI} ports: - "3000:3000" diff --git a/webapp/Dockerfile b/webapp/Dockerfile index 326f05c9..cc71f38a 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -6,9 +6,6 @@ WORKDIR /app #Install the dependencies RUN npm install -ARG API_URI -ENV REACT_APP_API_ENDPOINT $API_URI - #Create an optimized version of the webapp RUN npm run build RUN npm install serve From 393e8dfbcf05951e8a5add525ef1dc38ad919410 Mon Sep 17 00:00:00 2001 From: Dario Date: Sat, 9 Mar 2024 11:16:25 +0100 Subject: [PATCH 2/5] fix: needs to be from other branch --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c4dd1406..ae14d53a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,7 +61,7 @@ jobs: user: ${{ secrets.DEPLOY_USER }} key: ${{ secrets.DEPLOY_KEY }} command: | - wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/docker-compose.yml -O docker-compose.yml + wget https://github.com/Arquisoft/wiq_en2b/tree/fix/actions/docker-compose.yml -O docker-compose.yml wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/.env docker compose down docker compose --profile prod up -d From 0dd7157a592c08ddec9d12abf4f46de2fc68beb8 Mon Sep 17 00:00:00 2001 From: Dario Date: Sat, 9 Mar 2024 11:18:39 +0100 Subject: [PATCH 3/5] fix: added env vars --- .github/workflows/release.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ae14d53a..84592c4c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -62,6 +62,10 @@ jobs: key: ${{ secrets.DEPLOY_KEY }} command: | wget https://github.com/Arquisoft/wiq_en2b/tree/fix/actions/docker-compose.yml -O docker-compose.yml - wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/.env + wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/.env -O .env + echo "DATABASE_USER=${{ secrets.DATABASE_USER }}" >> .env + echo "DATABASE_PASSWORD=${{ secrets.DATABASE_PASSWORD }}" >> .env + echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env + echo "API_URI=http://${{ secrets.DEPLOY_HOST }}:8080" >> .env docker compose down docker compose --profile prod up -d From 37cc0efe0663f9357f557666d9872a76e3692f90 Mon Sep 17 00:00:00 2001 From: Dario Date: Sat, 9 Mar 2024 11:29:44 +0100 Subject: [PATCH 4/5] fix: updated docker compose --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 84592c4c..a9a9c491 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,7 +61,7 @@ jobs: user: ${{ secrets.DEPLOY_USER }} key: ${{ secrets.DEPLOY_KEY }} command: | - wget https://github.com/Arquisoft/wiq_en2b/tree/fix/actions/docker-compose.yml -O docker-compose.yml + wget https://github.com/Arquisoft/wiq_en2b/blob/fix/actions/docker-compose.yml -O docker-compose.yml wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/.env -O .env echo "DATABASE_USER=${{ secrets.DATABASE_USER }}" >> .env echo "DATABASE_PASSWORD=${{ secrets.DATABASE_PASSWORD }}" >> .env From c90c2c68e4cf6df58ff50ceacb6ab7c39c173035 Mon Sep 17 00:00:00 2001 From: Dario Date: Sat, 9 Mar 2024 11:35:19 +0100 Subject: [PATCH 5/5] fix: fixed wget --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a9a9c491..03dfb215 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,7 +61,7 @@ jobs: user: ${{ secrets.DEPLOY_USER }} key: ${{ secrets.DEPLOY_KEY }} command: | - wget https://github.com/Arquisoft/wiq_en2b/blob/fix/actions/docker-compose.yml -O docker-compose.yml + wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/fix/actions/docker-compose.yml -O docker-compose.yml wget https://raw.githubusercontent.com/arquisoft/wiq_en2b/master/.env -O .env echo "DATABASE_USER=${{ secrets.DATABASE_USER }}" >> .env echo "DATABASE_PASSWORD=${{ secrets.DATABASE_PASSWORD }}" >> .env