From a01a08e0e972fb1aeb188b55fc845edb2101d63b Mon Sep 17 00:00:00 2001 From: UO276213 Date: Tue, 26 Apr 2022 17:43:24 +0200 Subject: [PATCH] Despligue en Azure --- .github/workflows/asw2122.yml | 17 +++++++++++++++++ docker-compose-deploy.yml | 12 ++++++++++++ webapp/Dockerfile | 4 ++++ 3 files changed, 33 insertions(+) create mode 100644 docker-compose-deploy.yml diff --git a/.github/workflows/asw2122.yml b/.github/workflows/asw2122.yml index 4eaa0f2..3ee102a 100644 --- a/.github/workflows/asw2122.yml +++ b/.github/workflows/asw2122.yml @@ -71,3 +71,20 @@ jobs: password: ${{ secrets.DOCKER_PUSH_TOKEN }} registry: ghcr.io workdir: restapi + deploy: + name: Deploy over SSH + runs-on: ubuntu-latest + needs: [docker-push-restapi,docker-push-webapp] + steps: + - name: Deploy over SSH + uses: fifsky/ssh-action@master + with: + host: ${{ secrets.DEPLOY_HOST }} + user: ${{ secrets.DEPLOY_USER }} + key: ${{ secrets.DEPLOY_KEY }} + command: | + wget https://raw.githubusercontent.com/pglez82/asw2122_0/master/docker-compose-deploy.yml -O docker-compose.yml + docker-compose stop + docker-compose rm -f + docker-compose pull + docker-compose up -d diff --git a/docker-compose-deploy.yml b/docker-compose-deploy.yml new file mode 100644 index 0000000..2942b60 --- /dev/null +++ b/docker-compose-deploy.yml @@ -0,0 +1,12 @@ +version: '3.5' +services: + restapi: + image: ghcr.io/pglez82/asw2122_0/restapi:latest + ports: + - "5000:5000" + webapp: + image: ghcr.io/pglez82/asw2122_0/webapp:latest + ports: + - "3000:3000" + depends_on: + - restapi \ No newline at end of file diff --git a/webapp/Dockerfile b/webapp/Dockerfile index 51c632e..a034712 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -5,6 +5,10 @@ WORKDIR /app #Install the dependencies RUN npm install +# Variables for deploy in Azure +ARG API_URI="http://localhost:5000/api" +ENV REACT_APP_API_URI=$API_URI + #Create an optimized version of the webapp RUN npm run build