From 295e1c5ece1c682ff5b561bfc3496641e781e7e1 Mon Sep 17 00:00:00 2001 From: Marcello Alexandre Date: Wed, 22 Nov 2023 11:17:32 -0300 Subject: [PATCH 1/7] Add new dockerfile --- Dockerfile | 48 ++++++++++---------------------------------- docker-entrypoint.sh | 0 nginx.conf | 14 +++++++++---- 3 files changed, 21 insertions(+), 41 deletions(-) mode change 100644 => 100755 docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 583dc326..c86485db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,48 +1,22 @@ FROM node:14.17.4-alpine3.14 as builder -ENV WORKDIR /app -WORKDIR $WORKDIR +WORKDIR /app -RUN apk update && apk add git yarn - -COPY package.json . -COPY yarn.lock . +RUN apk add --no-cache git +COPY package.json yarn.lock ./ RUN yarn install -COPY . . - -ARG VUE_APP_API_BASE_URL -ARG VUE_APP_USE_SENTRY -ARG VUE_APP_SENTRY_DSN -ARG VUE_APP_FACEBOOK_APP_ID -ARG VUE_APP_WHATSAPP_FACEBOOK_APP_ID -ARG VUE_APP_LOGROCKET_ID -ARG VUE_APP_PARENT_IFRAME_DOMAIN -ARG VUE_APP_HELPHERO_ID -ARG VUE_APP_FLOWS_IFRAME_URL - -ENV VUE_APP_API_BASE_URL $VUE_APP_API_BASE_URL -ENV VUE_APP_USE_SENTRY $VUE_APP_USE_SENTRY -ENV VUE_APP_SENTRY_DSN $VUE_APP_SENTRY_DSN -ENV VUE_APP_FACEBOOK_APP_ID $VUE_APP_FACEBOOK_APP_ID -ENV VUE_APP_WHATSAPP_FACEBOOK_APP_ID $VUE_APP_WHATSAPP_FACEBOOK_APP_ID -ENV VUE_APP_LOGROCKET_ID $VUE_APP_LOGROCKET_ID -ENV VUE_APP_PARENT_IFRAME_DOMAIN $VUE_APP_PARENT_IFRAME_DOMAIN -ENV VUE_APP_HELPHERO_ID $VUE_APP_HELPHERO_ID -ENV VUE_APP_FLOWS_IFRAME_URL $VUE_APP_FLOWS_IFRAME_URL +COPY . ./ RUN yarn build -FROM nginx - -COPY nginx.conf /etc/nginx/nginx.conf -COPY --from=builder /app/dist /usr/share/nginx/html/integrations - -COPY docker-entrypoint.sh /usr/share/nginx/ - -RUN chmod +x /usr/share/nginx/docker-entrypoint.sh +FROM nginxinc/nginx-unprivileged:1.25 -ENTRYPOINT ["/usr/share/nginx/docker-entrypoint.sh"] +COPY --chown=nginx:nginx nginx.conf /etc/nginx/nginx.conf +COPY --from=builder --chown=nginx:nginx /app/dist /usr/share/nginx/html/integrations/ +COPY docker-entrypoint.sh / -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +EXPOSE 8080 +ENTRYPOINT ["bash","/docker-entrypoint.sh"] +CMD ["nginx", "-g", "daemon off;"] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh old mode 100644 new mode 100755 diff --git a/nginx.conf b/nginx.conf index 8ff77f5a..6738f7c6 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,14 +1,20 @@ user nginx; worker_processes 1; -error_log /var/log/nginx/error.log warn; -pid /var/run/nginx.pid; +error_log /dev/stdout warn; +pid /tmp/nginx.pid; events { worker_connections 1024; } http { + proxy_temp_path /tmp/proxy_temp; + client_body_temp_path /tmp/client_temp; + fastcgi_temp_path /tmp/fastcgi_temp; + uwsgi_temp_path /tmp/uwsgi_temp; + scgi_temp_path /tmp/scgi_temp; + include /etc/nginx/mime.types; default_type application/octet-stream; charset UTF-8; @@ -16,10 +22,10 @@ http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; - access_log /var/log/nginx/access.log main; + access_log /dev/stdout main; server { - listen 80; + listen 8080; server_name localhost; client_max_body_size 32m; From 804670a35b10f29a7af0f53a6594a6e25e99c6f4 Mon Sep 17 00:00:00 2001 From: Marcello Alexandre Date: Wed, 22 Nov 2023 11:20:27 -0300 Subject: [PATCH 2/7] Change manifest branch --- .../workflows/build-integrations-webapp-push-tag-shared.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-integrations-webapp-push-tag-shared.yaml b/.github/workflows/build-integrations-webapp-push-tag-shared.yaml index d0dbc41f..a5e35305 100644 --- a/.github/workflows/build-integrations-webapp-push-tag-shared.yaml +++ b/.github/workflows/build-integrations-webapp-push-tag-shared.yaml @@ -128,5 +128,6 @@ jobs: github_token: "${{ secrets.DEVOPS_GITHUB_PERMANENT_TOKEN }}" repository: "${{ env.MANIFESTS_REPOSITORY }}" directory: ./kubernetes-manifests/ - branch: main + #branch: main + branch: feat/integrations-webapp-new-image message: "From Integrations WebApp Build (Push Tag ${{ env.MANIFESTS_ENVIRONMENT }})" From 612e1e281471e2c3efa4ef7306cf6f82418eb365 Mon Sep 17 00:00:00 2001 From: Marcello Alexandre Date: Wed, 22 Nov 2023 14:49:29 -0300 Subject: [PATCH 3/7] Configure Dockerfile and entrypoint using /tmp --- Dockerfile | 3 +++ docker-entrypoint.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c86485db..6bf35c6b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,9 @@ FROM nginxinc/nginx-unprivileged:1.25 COPY --chown=nginx:nginx nginx.conf /etc/nginx/nginx.conf COPY --from=builder --chown=nginx:nginx /app/dist /usr/share/nginx/html/integrations/ COPY docker-entrypoint.sh / +RUN mv /usr/share/nginx/html/integrations/index.html /usr/share/nginx/html/integrations/index.html.tmpl \ + && cd /usr/share/nginx/html/integrations/ \ + && ln -s /tmp/index.html EXPOSE 8080 ENTRYPOINT ["bash","/docker-entrypoint.sh"] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index ff22e167..7435aee4 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -10,6 +10,6 @@ export JSON_STRING='window.configs = { \ "VUE_APP_HELPHERO_ID":"'${VUE_APP_HELPHERO_ID}'", \ "VUE_APP_FLOWS_IFRAME_URL":"'${VUE_APP_FLOWS_IFRAME_URL}'", \ }' -sed -i "s|//CONFIGURATIONS_PLACEHOLDER|${JSON_STRING}|" /usr/share/nginx/html/integrations/index.html +sed "s|//CONFIGURATIONS_PLACEHOLDER|${JSON_STRING}|" /usr/share/nginx/html/integrations/index.html.tmpl > /tmp/index.html exec "$@" \ No newline at end of file From ad5451d3ad2204b7dfd074907b403eb1445ab128 Mon Sep 17 00:00:00 2001 From: Marcello Alexandre Date: Thu, 23 Nov 2023 16:09:39 -0300 Subject: [PATCH 4/7] Fix Check out Kubernetes Manifests for test branch --- .../workflows/build-integrations-webapp-push-tag-shared.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-integrations-webapp-push-tag-shared.yaml b/.github/workflows/build-integrations-webapp-push-tag-shared.yaml index a5e35305..c426c4e9 100644 --- a/.github/workflows/build-integrations-webapp-push-tag-shared.yaml +++ b/.github/workflows/build-integrations-webapp-push-tag-shared.yaml @@ -71,7 +71,8 @@ jobs: - name: Check out Kubernetes Manifests uses: actions/checkout@master with: - ref: main + #ref: main + ref: feat/integrations-webapp-new-image repository: "${{ env.MANIFESTS_REPOSITORY }}" token: "${{ secrets.DEVOPS_GITHUB_PERMANENT_TOKEN }}" path: ./kubernetes-manifests/ From 05cea1f447e3275b94c059a175b8e87f901d683a Mon Sep 17 00:00:00 2001 From: Marcello Alexandre Date: Fri, 24 Nov 2023 08:37:35 -0300 Subject: [PATCH 5/7] Remove user nginx in nginx.conf --- nginx.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/nginx.conf b/nginx.conf index 6738f7c6..afc23f7a 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,4 +1,3 @@ -user nginx; worker_processes 1; error_log /dev/stdout warn; From 8737b05c47bbf3be1cd26ec04fa5615e61f734e2 Mon Sep 17 00:00:00 2001 From: Marcello Alexandre Date: Mon, 27 Nov 2023 13:25:27 -0300 Subject: [PATCH 6/7] Change branch action for main --- .../build-integrations-webapp-push-tag-shared.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-integrations-webapp-push-tag-shared.yaml b/.github/workflows/build-integrations-webapp-push-tag-shared.yaml index c426c4e9..d0dbc41f 100644 --- a/.github/workflows/build-integrations-webapp-push-tag-shared.yaml +++ b/.github/workflows/build-integrations-webapp-push-tag-shared.yaml @@ -71,8 +71,7 @@ jobs: - name: Check out Kubernetes Manifests uses: actions/checkout@master with: - #ref: main - ref: feat/integrations-webapp-new-image + ref: main repository: "${{ env.MANIFESTS_REPOSITORY }}" token: "${{ secrets.DEVOPS_GITHUB_PERMANENT_TOKEN }}" path: ./kubernetes-manifests/ @@ -129,6 +128,5 @@ jobs: github_token: "${{ secrets.DEVOPS_GITHUB_PERMANENT_TOKEN }}" repository: "${{ env.MANIFESTS_REPOSITORY }}" directory: ./kubernetes-manifests/ - #branch: main - branch: feat/integrations-webapp-new-image + branch: main message: "From Integrations WebApp Build (Push Tag ${{ env.MANIFESTS_ENVIRONMENT }})" From 5e8b5cfc2cd4373475d4251e92bcb743594297cc Mon Sep 17 00:00:00 2001 From: Marcello Alexandre Date: Tue, 28 Nov 2023 10:14:40 -0300 Subject: [PATCH 7/7] Add user nginx --- nginx.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/nginx.conf b/nginx.conf index afc23f7a..6738f7c6 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,3 +1,4 @@ +user nginx; worker_processes 1; error_log /dev/stdout warn;