From 2af0ec16d4caf6e845d566c3e8ab4ac4e10c37ee Mon Sep 17 00:00:00 2001 From: oscarlopezgonzalez Date: Mon, 4 Apr 2022 09:51:45 +0200 Subject: [PATCH] =?UTF-8?q?A=C3=B1ade=20cambios=20extras=20para=20que=20fu?= =?UTF-8?q?ncione=20el=20despliegue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/asw2122.yml | 2 ++ restapi/server.ts | 3 ++- webapp/Dockerfile | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/asw2122.yml b/.github/workflows/asw2122.yml index 54ca0aa..c4f8114 100644 --- a/.github/workflows/asw2122.yml +++ b/.github/workflows/asw2122.yml @@ -45,6 +45,8 @@ jobs: - run: npm --prefix webapp run test:e2e docker-push-webapp: name: Push webapp Docker Image to GitHub Packages + env: + API_URI: http://${{ secrets.DEPLOY_HOST }}:5000/api runs-on: ubuntu-latest needs: [e2e-tests] steps: diff --git a/restapi/server.ts b/restapi/server.ts index a7cbf9e..abc47cf 100644 --- a/restapi/server.ts +++ b/restapi/server.ts @@ -30,7 +30,8 @@ app.use(expressSession({ const metricsMiddleware:RequestHandler = promBundle({includeMethod: true}); app.use(metricsMiddleware); -app.use(cors(options)); +//app.use(cors(options)); +app.use(cors()) app.use(bp.json()); app.use("/api", api); diff --git a/webapp/Dockerfile b/webapp/Dockerfile index 424d1be..9310b2b 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -6,6 +6,8 @@ WORKDIR /app RUN npm install #Create an optimized version of the webapp +ARG API_URI="http://localhost:5000/api" +ENV REACT_APP_API_URI=$API_URI RUN npm run build #Ver como podemos llamar npm run prod aquĆ­