From 4e0d0c0950accee4d0f939c9546a6482bcf17da0 Mon Sep 17 00:00:00 2001 From: gokhangunduz Date: Mon, 11 Dec 2023 16:52:36 +0300 Subject: [PATCH] refactor(workflows): :tada: update action workflows --- .github/workflows/backup.yaml | 32 --------------- .github/workflows/onpremise-amz-01.yaml | 41 +++++++++++++++++++ .github/workflows/onpremise-auto-01.yaml | 41 +++++++++++++++++++ .github/workflows/onpremise-auto-02.yaml | 41 +++++++++++++++++++ .github/workflows/onpremise-def-01.yaml | 41 +++++++++++++++++++ .github/workflows/onpremise-hha-01.yaml | 41 +++++++++++++++++++ .github/workflows/onpremise-rl-01.yaml | 41 +++++++++++++++++++ .github/workflows/public-demo.yaml | 41 +++++++++++++++++++ .../workflows/{dev.yaml => public-dev.yaml} | 22 +++++----- Dockerfile | 27 +++++++----- Dockerfile-dev | 16 -------- 11 files changed, 314 insertions(+), 70 deletions(-) delete mode 100644 .github/workflows/backup.yaml create mode 100644 .github/workflows/onpremise-amz-01.yaml create mode 100644 .github/workflows/onpremise-auto-01.yaml create mode 100644 .github/workflows/onpremise-auto-02.yaml create mode 100644 .github/workflows/onpremise-def-01.yaml create mode 100644 .github/workflows/onpremise-hha-01.yaml create mode 100644 .github/workflows/onpremise-rl-01.yaml create mode 100644 .github/workflows/public-demo.yaml rename .github/workflows/{dev.yaml => public-dev.yaml} (57%) delete mode 100644 Dockerfile-dev diff --git a/.github/workflows/backup.yaml b/.github/workflows/backup.yaml deleted file mode 100644 index 3a0d7982..00000000 --- a/.github/workflows/backup.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: Docker Image CI - -on: - push: - branches: - - main - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - # - name: Checkout Code - # uses: actions/checkout@v3 - - # - name: Extract Version from package.json - # id: project_version - # run: echo "::set-output name=version::$(node -e 'console.log(require("./package.json").version)')" - - # - name: Build the Docker Image - # run: | - # docker build \ - # --file Dockerfile-dev \ - # --tag robolaunchio/frontend-public:${{ steps.project_version.outputs.version }}-dev \ - # . - - # - name: Login to Docker Hub - # run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} - - # - name: Push the Docker Image to Docker Hub - # run: docker push robolaunchio/frontend-public:${{ steps.project_version.outputs.version }}-dev diff --git a/.github/workflows/onpremise-amz-01.yaml b/.github/workflows/onpremise-amz-01.yaml new file mode 100644 index 00000000..3eb54cc2 --- /dev/null +++ b/.github/workflows/onpremise-amz-01.yaml @@ -0,0 +1,41 @@ +name: Docker Image (onpremise-amz-01) + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + environment: + name: onpremise-amz-01 + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Extract Version from package.json + id: project_version + run: echo "::set-output name=version::$(node -e 'console.log(require("./package.json").version)')" + + - name: Build the Docker Image + run: | + docker build \ + --file Dockerfile \ + --tag robolaunchio/frontend-onpremise:${{ steps.project_version.outputs.version }}-amz-01 \ + --build-arg REACT_APP_BACKEND_URL=${{ secrets.REACT_APP_BACKEND_URL }} \ + --build-arg REACT_APP_KEYCLOAK_URL=${{ secrets.REACT_APP_KEYCLOAK_URL }} \ + --build-arg REACT_APP_KEYCLOAK_REALM=${{ secrets.REACT_APP_KEYCLOAK_REALM }} \ + --build-arg REACT_APP_KEYCLOAK_CLIENT_ID=${{ secrets.REACT_APP_KEYCLOAK_CLIENT_ID }} \ + --build-arg REACT_APP_APPLICATION=${{ secrets.REACT_APP_APPLICATION }} \ + --build-arg REACT_APP_CREATE_ORGANIZATION=${{ secrets.REACT_APP_CREATE_ORGANIZATION }} \ + --build-arg REACT_APP_CREATE_REGION=${{ secrets.REACT_APP_CREATE_REGION }} \ + --build-arg REACT_APP_CREATE_INSTANCE=${{ secrets.REACT_APP_CREATE_INSTANCE }} \ + . + + - name: Login to Docker Hub + run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + + - name: Push the Docker Image to Docker Hub + run: docker push robolaunchio/frontend-onpremise:${{ steps.project_version.outputs.version }}-amz-01 diff --git a/.github/workflows/onpremise-auto-01.yaml b/.github/workflows/onpremise-auto-01.yaml new file mode 100644 index 00000000..b011ad85 --- /dev/null +++ b/.github/workflows/onpremise-auto-01.yaml @@ -0,0 +1,41 @@ +name: Docker Image (onpremise-auto-01) + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + environment: + name: onpremise-auto-01 + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Extract Version from package.json + id: project_version + run: echo "::set-output name=version::$(node -e 'console.log(require("./package.json").version)')" + + - name: Build the Docker Image + run: | + docker build \ + --file Dockerfile \ + --tag robolaunchio/frontend-onpremise:${{ steps.project_version.outputs.version }}-auto-01 \ + --build-arg REACT_APP_BACKEND_URL=${{ secrets.REACT_APP_BACKEND_URL }} \ + --build-arg REACT_APP_KEYCLOAK_URL=${{ secrets.REACT_APP_KEYCLOAK_URL }} \ + --build-arg REACT_APP_KEYCLOAK_REALM=${{ secrets.REACT_APP_KEYCLOAK_REALM }} \ + --build-arg REACT_APP_KEYCLOAK_CLIENT_ID=${{ secrets.REACT_APP_KEYCLOAK_CLIENT_ID }} \ + --build-arg REACT_APP_APPLICATION=${{ secrets.REACT_APP_APPLICATION }} \ + --build-arg REACT_APP_CREATE_ORGANIZATION=${{ secrets.REACT_APP_CREATE_ORGANIZATION }} \ + --build-arg REACT_APP_CREATE_REGION=${{ secrets.REACT_APP_CREATE_REGION }} \ + --build-arg REACT_APP_CREATE_INSTANCE=${{ secrets.REACT_APP_CREATE_INSTANCE }} \ + . + + - name: Login to Docker Hub + run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + + - name: Push the Docker Image to Docker Hub + run: docker push robolaunchio/frontend-onpremise:${{ steps.project_version.outputs.version }}-auto-01 diff --git a/.github/workflows/onpremise-auto-02.yaml b/.github/workflows/onpremise-auto-02.yaml new file mode 100644 index 00000000..24b66aec --- /dev/null +++ b/.github/workflows/onpremise-auto-02.yaml @@ -0,0 +1,41 @@ +name: Docker Image (onpremise-auto-02) + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + environment: + name: onpremise-auto-02 + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Extract Version from package.json + id: project_version + run: echo "::set-output name=version::$(node -e 'console.log(require("./package.json").version)')" + + - name: Build the Docker Image + run: | + docker build \ + --file Dockerfile \ + --tag robolaunchio/frontend-onpremise:${{ steps.project_version.outputs.version }}-auto-02 \ + --build-arg REACT_APP_BACKEND_URL=${{ secrets.REACT_APP_BACKEND_URL }} \ + --build-arg REACT_APP_KEYCLOAK_URL=${{ secrets.REACT_APP_KEYCLOAK_URL }} \ + --build-arg REACT_APP_KEYCLOAK_REALM=${{ secrets.REACT_APP_KEYCLOAK_REALM }} \ + --build-arg REACT_APP_KEYCLOAK_CLIENT_ID=${{ secrets.REACT_APP_KEYCLOAK_CLIENT_ID }} \ + --build-arg REACT_APP_APPLICATION=${{ secrets.REACT_APP_APPLICATION }} \ + --build-arg REACT_APP_CREATE_ORGANIZATION=${{ secrets.REACT_APP_CREATE_ORGANIZATION }} \ + --build-arg REACT_APP_CREATE_REGION=${{ secrets.REACT_APP_CREATE_REGION }} \ + --build-arg REACT_APP_CREATE_INSTANCE=${{ secrets.REACT_APP_CREATE_INSTANCE }} \ + . + + - name: Login to Docker Hub + run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + + - name: Push the Docker Image to Docker Hub + run: docker push robolaunchio/frontend-onpremise:${{ steps.project_version.outputs.version }}-auto-02 diff --git a/.github/workflows/onpremise-def-01.yaml b/.github/workflows/onpremise-def-01.yaml new file mode 100644 index 00000000..1282f574 --- /dev/null +++ b/.github/workflows/onpremise-def-01.yaml @@ -0,0 +1,41 @@ +name: Docker Image (onpremise-def-01) + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + environment: + name: onpremise-def-01 + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Extract Version from package.json + id: project_version + run: echo "::set-output name=version::$(node -e 'console.log(require("./package.json").version)')" + + - name: Build the Docker Image + run: | + docker build \ + --file Dockerfile \ + --tag robolaunchio/frontend-onpremise:${{ steps.project_version.outputs.version }}-def-01 \ + --build-arg REACT_APP_BACKEND_URL=${{ secrets.REACT_APP_BACKEND_URL }} \ + --build-arg REACT_APP_KEYCLOAK_URL=${{ secrets.REACT_APP_KEYCLOAK_URL }} \ + --build-arg REACT_APP_KEYCLOAK_REALM=${{ secrets.REACT_APP_KEYCLOAK_REALM }} \ + --build-arg REACT_APP_KEYCLOAK_CLIENT_ID=${{ secrets.REACT_APP_KEYCLOAK_CLIENT_ID }} \ + --build-arg REACT_APP_APPLICATION=${{ secrets.REACT_APP_APPLICATION }} \ + --build-arg REACT_APP_CREATE_ORGANIZATION=${{ secrets.REACT_APP_CREATE_ORGANIZATION }} \ + --build-arg REACT_APP_CREATE_REGION=${{ secrets.REACT_APP_CREATE_REGION }} \ + --build-arg REACT_APP_CREATE_INSTANCE=${{ secrets.REACT_APP_CREATE_INSTANCE }} \ + . + + - name: Login to Docker Hub + run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + + - name: Push the Docker Image to Docker Hub + run: docker push robolaunchio/frontend-onpremise:${{ steps.project_version.outputs.version }}-def-01 diff --git a/.github/workflows/onpremise-hha-01.yaml b/.github/workflows/onpremise-hha-01.yaml new file mode 100644 index 00000000..b909897c --- /dev/null +++ b/.github/workflows/onpremise-hha-01.yaml @@ -0,0 +1,41 @@ +name: Docker Image (onpremise-hha-01) + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + environment: + name: onpremise-hha-01 + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Extract Version from package.json + id: project_version + run: echo "::set-output name=version::$(node -e 'console.log(require("./package.json").version)')" + + - name: Build the Docker Image + run: | + docker build \ + --file Dockerfile \ + --tag robolaunchio/frontend-onpremise:${{ steps.project_version.outputs.version }}-hha-01 \ + --build-arg REACT_APP_BACKEND_URL=${{ secrets.REACT_APP_BACKEND_URL }} \ + --build-arg REACT_APP_KEYCLOAK_URL=${{ secrets.REACT_APP_KEYCLOAK_URL }} \ + --build-arg REACT_APP_KEYCLOAK_REALM=${{ secrets.REACT_APP_KEYCLOAK_REALM }} \ + --build-arg REACT_APP_KEYCLOAK_CLIENT_ID=${{ secrets.REACT_APP_KEYCLOAK_CLIENT_ID }} \ + --build-arg REACT_APP_APPLICATION=${{ secrets.REACT_APP_APPLICATION }} \ + --build-arg REACT_APP_CREATE_ORGANIZATION=${{ secrets.REACT_APP_CREATE_ORGANIZATION }} \ + --build-arg REACT_APP_CREATE_REGION=${{ secrets.REACT_APP_CREATE_REGION }} \ + --build-arg REACT_APP_CREATE_INSTANCE=${{ secrets.REACT_APP_CREATE_INSTANCE }} \ + . + + - name: Login to Docker Hub + run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + + - name: Push the Docker Image to Docker Hub + run: docker push robolaunchio/frontend-onpremise:${{ steps.project_version.outputs.version }}-hha-01 diff --git a/.github/workflows/onpremise-rl-01.yaml b/.github/workflows/onpremise-rl-01.yaml new file mode 100644 index 00000000..22e4cb07 --- /dev/null +++ b/.github/workflows/onpremise-rl-01.yaml @@ -0,0 +1,41 @@ +name: Docker Image (onpremise-rl-01) + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + environment: + name: onpremise-rl-01 + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Extract Version from package.json + id: project_version + run: echo "::set-output name=version::$(node -e 'console.log(require("./package.json").version)')" + + - name: Build the Docker Image + run: | + docker build \ + --file Dockerfile \ + --tag robolaunchio/frontend-onpremise:${{ steps.project_version.outputs.version }}-rl-01 \ + --build-arg REACT_APP_BACKEND_URL=${{ secrets.REACT_APP_BACKEND_URL }} \ + --build-arg REACT_APP_KEYCLOAK_URL=${{ secrets.REACT_APP_KEYCLOAK_URL }} \ + --build-arg REACT_APP_KEYCLOAK_REALM=${{ secrets.REACT_APP_KEYCLOAK_REALM }} \ + --build-arg REACT_APP_KEYCLOAK_CLIENT_ID=${{ secrets.REACT_APP_KEYCLOAK_CLIENT_ID }} \ + --build-arg REACT_APP_APPLICATION=${{ secrets.REACT_APP_APPLICATION }} \ + --build-arg REACT_APP_CREATE_ORGANIZATION=${{ secrets.REACT_APP_CREATE_ORGANIZATION }} \ + --build-arg REACT_APP_CREATE_REGION=${{ secrets.REACT_APP_CREATE_REGION }} \ + --build-arg REACT_APP_CREATE_INSTANCE=${{ secrets.REACT_APP_CREATE_INSTANCE }} \ + . + + - name: Login to Docker Hub + run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + + - name: Push the Docker Image to Docker Hub + run: docker push robolaunchio/frontend-onpremise:${{ steps.project_version.outputs.version }}-rl-01 diff --git a/.github/workflows/public-demo.yaml b/.github/workflows/public-demo.yaml new file mode 100644 index 00000000..aa18b5d5 --- /dev/null +++ b/.github/workflows/public-demo.yaml @@ -0,0 +1,41 @@ +name: Docker Image (public-demo) + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + environment: + name: public-demo + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Extract Version from package.json + id: project_version + run: echo "::set-output name=version::$(node -e 'console.log(require("./package.json").version)')" + + - name: Build the Docker Image + run: | + docker build \ + --file Dockerfile \ + --tag robolaunchio/frontend-public:${{ steps.project_version.outputs.version }}-demo \ + --build-arg REACT_APP_BACKEND_URL=${{ secrets.REACT_APP_BACKEND_URL }} \ + --build-arg REACT_APP_KEYCLOAK_URL=${{ secrets.REACT_APP_KEYCLOAK_URL }} \ + --build-arg REACT_APP_KEYCLOAK_REALM=${{ secrets.REACT_APP_KEYCLOAK_REALM }} \ + --build-arg REACT_APP_KEYCLOAK_CLIENT_ID=${{ secrets.REACT_APP_KEYCLOAK_CLIENT_ID }} \ + --build-arg REACT_APP_APPLICATION=${{ secrets.REACT_APP_APPLICATION }} \ + --build-arg REACT_APP_CREATE_ORGANIZATION=${{ secrets.REACT_APP_CREATE_ORGANIZATION }} \ + --build-arg REACT_APP_CREATE_REGION=${{ secrets.REACT_APP_CREATE_REGION }} \ + --build-arg REACT_APP_CREATE_INSTANCE=${{ secrets.REACT_APP_CREATE_INSTANCE }} \ + . + + - name: Login to Docker Hub + run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + + - name: Push the Docker Image to Docker Hub + run: docker push robolaunchio/frontend-public:${{ steps.project_version.outputs.version }}-demo diff --git a/.github/workflows/dev.yaml b/.github/workflows/public-dev.yaml similarity index 57% rename from .github/workflows/dev.yaml rename to .github/workflows/public-dev.yaml index 1d37f28b..8a41632c 100644 --- a/.github/workflows/dev.yaml +++ b/.github/workflows/public-dev.yaml @@ -1,4 +1,4 @@ -name: Docker Image CI +name: Docker Image (public-dev) on: push: @@ -9,7 +9,7 @@ jobs: build: runs-on: ubuntu-latest environment: - name: development + name: public-dev steps: - name: Checkout Code @@ -22,16 +22,16 @@ jobs: - name: Build the Docker Image run: | docker build \ - --file Dockerfile-dev \ + --file Dockerfile \ --tag robolaunchio/frontend-public:${{ steps.project_version.outputs.version }}-dev \ - --build-arg REACT_APP_BACKEND_URL=${{ secrets.DEV_REACT_APP_BACKEND_URL }} \ - --build-arg REACT_APP_KEYCLOAK_URL=${{ secrets.DEV_REACT_APP_KEYCLOAK_URL }} \ - --build-arg REACT_APP_KEYCLOAK_REALM=${{ secrets.DEV_REACT_APP_KEYCLOAK_REALM }} \ - --build-arg REACT_APP_KEYCLOAK_CLIENT_ID=${{ secrets.DEV_REACT_APP_KEYCLOAK_CLIENT_ID }} \ - --build-arg REACT_APP_APPLICATION=${{ secrets.DEV_REACT_APP_APPLICATION }} \ - --build-arg REACT_APP_CREATE_ORGANIZATION=${{ secrets.DEV_REACT_APP_CREATE_ORGANIZATION }} \ - --build-arg REACT_APP_CREATE_REGION=${{ secrets.DEV_REACT_APP_CREATE_REGION }} \ - --build-arg REACT_APP_CREATE_INSTANCE=${{ secrets.DEV_REACT_APP_CREATE_INSTANCE }} \ + --build-arg REACT_APP_BACKEND_URL=${{ secrets.REACT_APP_BACKEND_URL }} \ + --build-arg REACT_APP_KEYCLOAK_URL=${{ secrets.REACT_APP_KEYCLOAK_URL }} \ + --build-arg REACT_APP_KEYCLOAK_REALM=${{ secrets.REACT_APP_KEYCLOAK_REALM }} \ + --build-arg REACT_APP_KEYCLOAK_CLIENT_ID=${{ secrets.REACT_APP_KEYCLOAK_CLIENT_ID }} \ + --build-arg REACT_APP_APPLICATION=${{ secrets.REACT_APP_APPLICATION }} \ + --build-arg REACT_APP_CREATE_ORGANIZATION=${{ secrets.REACT_APP_CREATE_ORGANIZATION }} \ + --build-arg REACT_APP_CREATE_REGION=${{ secrets.REACT_APP_CREATE_REGION }} \ + --build-arg REACT_APP_CREATE_INSTANCE=${{ secrets.REACT_APP_CREATE_INSTANCE }} \ . - name: Login to Docker Hub diff --git a/Dockerfile b/Dockerfile index 37f7d57d..3f181b0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,16 @@ -FROM ubuntu:20.04 -RUN apt-get update -RUN ln -fs /usr/share/zoneinfo/Europe/Istanbul /etc/localtime -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata -RUN apt-get update && apt-get install -y wget curl vim mlocate apache2 -RUN a2enmod rewrite -ADD build /var/www/html/ -COPY .htaccess /var/www/html/.htaccess -COPY 000-default.conf /etc/apache2/sites-enabled/ -RUN echo ServerName 127.0.0.1 >> /etc/apache2/apache2.conf -ENTRYPOINT ["apachectl", "-D", "FOREGROUND"] \ No newline at end of file +FROM node:latest as build-stage +ARG REACT_APP_BACKEND_URL +ARG REACT_APP_KEYCLOAK_URL +ARG REACT_APP_KEYCLOAK_REALM +ARG REACT_APP_KEYCLOAK_CLIENT_ID +ARG REACT_APP_APPLICATION +ARG REACT_APP_CREATE_ORGANIZATION +ARG REACT_APP_CREATE_REGION +ARG REACT_APP_CREATE_INSTANCE +COPY . /app +WORKDIR /app +RUN npm install +RUN NODE_OPTIONS="--max-old-space-size=4096" npm run build +FROM nginx:alpine as production-stage +COPY --from=build-stage /app/build /usr/share/nginx/html +EXPOSE 80 \ No newline at end of file diff --git a/Dockerfile-dev b/Dockerfile-dev deleted file mode 100644 index 3f181b0b..00000000 --- a/Dockerfile-dev +++ /dev/null @@ -1,16 +0,0 @@ -FROM node:latest as build-stage -ARG REACT_APP_BACKEND_URL -ARG REACT_APP_KEYCLOAK_URL -ARG REACT_APP_KEYCLOAK_REALM -ARG REACT_APP_KEYCLOAK_CLIENT_ID -ARG REACT_APP_APPLICATION -ARG REACT_APP_CREATE_ORGANIZATION -ARG REACT_APP_CREATE_REGION -ARG REACT_APP_CREATE_INSTANCE -COPY . /app -WORKDIR /app -RUN npm install -RUN NODE_OPTIONS="--max-old-space-size=4096" npm run build -FROM nginx:alpine as production-stage -COPY --from=build-stage /app/build /usr/share/nginx/html -EXPOSE 80 \ No newline at end of file