From 6d82e66af4bfe07041c0ffc5790948ab7a9a5e40 Mon Sep 17 00:00:00 2001 From: Paradoxe Ngwasi Date: Sat, 2 Dec 2023 17:42:07 +0000 Subject: [PATCH 1/3] [Layerfile] Update the Layerfile and Layerfile.build, and introduce Layerfile.node --- Layerfile | 6 ++---- Layerfile.build | 22 ++++++++++++++++++++++ Layerfile.node | 22 ++++++++++++++++++++++ 3 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 Layerfile.build create mode 100644 Layerfile.node diff --git a/Layerfile b/Layerfile index 26850d39b..45b09dbfe 100644 --- a/Layerfile +++ b/Layerfile @@ -11,10 +11,8 @@ RUN apt-get update && \ apt-get update && \ apt-get install docker-ce docker-ce-cli containerd.io -COPY . . +RUN REPEATABLE docker pull everco/ever-teams-webapp -RUN REPEATABLE docker build -t ever-teams . - -RUN REPEATABLE docker run -d -p 3000:3000 ever-teams && sleep 5 +RUN REPEATABLE docker run -d -p 3000:3000 everco/ever-teams-webapp && sleep 5 EXPOSE WEBSITE localhost:3000 diff --git a/Layerfile.build b/Layerfile.build new file mode 100644 index 000000000..bacc929c2 --- /dev/null +++ b/Layerfile.build @@ -0,0 +1,22 @@ +FROM vm/ubuntu:18.04 + +MEMORY 8G + +# install the latest version of Docker, as in the official Docker installation tutorial. +RUN apt-get update && \ + apt-get install ca-certificates curl gnupg lsb-release && \ + sudo mkdir -p /etc/apt/keyrings && \ + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \ + echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" |\ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null && \ + apt-get update && \ + apt-get install docker-ce docker-ce-cli containerd.io + +COPY . . + +RUN REPEATABLE docker build -t ever-teams . + +RUN REPEATABLE docker run -d -p 3000:3000 ever-teams && sleep 5 + +EXPOSE WEBSITE localhost:3000 diff --git a/Layerfile.node b/Layerfile.node new file mode 100644 index 000000000..30fd5915e --- /dev/null +++ b/Layerfile.node @@ -0,0 +1,22 @@ +FROM vm/ubuntu:22.04 + +ENV NODE_MAJOR=20 + +# install the latest version of Docker, as in the official Docker installation tutorial. +RUN apt-get update &&\ + apt-get install -y ca-certificates curl gnupg &&\ + sudo mkdir -p /etc/apt/keyrings &&\ + curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg &&\ + echo \ + "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" |\ + sudo tee /etc/apt/sources.list.d/nodesource.list &&\ + apt-get update &&\ + apt-get install nodejs yarn -y + +COPY . . + +RUN REPEATABLE cd apps/web && yarn install && yarn build + +RUN BACKGROUND yarn start:web + +EXPOSE WEBSITE localhost:3000 From dcb01761dba7e7ee35c0b25138a86bf0c596b638 Mon Sep 17 00:00:00 2001 From: Ruslan Konviser Date: Sat, 2 Dec 2023 18:57:30 +0100 Subject: [PATCH 2/3] chore: more logging --- .github/workflows/docker-build-publish-dev.yml | 3 +++ .github/workflows/docker-build-publish-prod.yml | 3 +++ Dockerfile | 5 +++++ apps/web/next.config.js | 1 - 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-build-publish-dev.yml b/.github/workflows/docker-build-publish-dev.yml index 4bd6f6a83..28d1145b7 100644 --- a/.github/workflows/docker-build-publish-dev.yml +++ b/.github/workflows/docker-build-publish-dev.yml @@ -21,6 +21,9 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - name: Output NEXT_PUBLIC_GAUZY_API_SERVER_URL + run: echo "NEXT_PUBLIC_GAUZY_API_SERVER_URL=${{ secrets.NEXT_PUBLIC_GAUZY_API_SERVER_URL }}" + - name: Build and push uses: docker/build-push-action@v4 with: diff --git a/.github/workflows/docker-build-publish-prod.yml b/.github/workflows/docker-build-publish-prod.yml index a47b6335b..efc2d0b75 100644 --- a/.github/workflows/docker-build-publish-prod.yml +++ b/.github/workflows/docker-build-publish-prod.yml @@ -21,6 +21,9 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - name: Output NEXT_PUBLIC_GAUZY_API_SERVER_URL + run: echo "NEXT_PUBLIC_GAUZY_API_SERVER_URL=${{ secrets.NEXT_PUBLIC_GAUZY_API_SERVER_URL }}" + - name: Build and push uses: docker/build-push-action@v4 with: diff --git a/Dockerfile b/Dockerfile index d1a5a52b0..8712f6f9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,9 @@ ARG NEXT_PUBLIC_CHATWOOT_API_KEY FROM node:${NODE_VERSION}-slim as base +# Output the environment variable value +RUN echo "NEXT_PUBLIC_GAUZY_API_SERVER_URL=${NEXT_PUBLIC_GAUZY_API_SERVER_URL}" + LABEL maintainer="ever@ever.co" LABEL org.opencontainers.image.source https://github.com/ever-co/ever-teams @@ -78,6 +81,8 @@ COPY . . ENV NODE_ENV=production +RUN echo $NEXT_PUBLIC_GAUZY_API_SERVER_URL + # Build application RUN yarn run build:web diff --git a/apps/web/next.config.js b/apps/web/next.config.js index 9fcde0150..eabcfd6e9 100644 --- a/apps/web/next.config.js +++ b/apps/web/next.config.js @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/no-var-requires */ const path = require('path'); -console.log(`GAUZY_API_SERVER_URL: ${process.env.GAUZY_API_SERVER_URL}`); console.log(`NEXT_PUBLIC_GAUZY_API_SERVER_URL: ${process.env.NEXT_PUBLIC_GAUZY_API_SERVER_URL}`); // eslint-disable-next-line @typescript-eslint/no-var-requires From 22c38736e2e98fb2ba13dba457bc934ad7a0b05a Mon Sep 17 00:00:00 2001 From: Ruslan Konviser Date: Sat, 2 Dec 2023 19:11:10 +0100 Subject: [PATCH 3/3] chore: envs --- .github/workflows/docker-build-publish-dev.yml | 3 +++ .github/workflows/docker-build-publish-prod.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/docker-build-publish-dev.yml b/.github/workflows/docker-build-publish-dev.yml index 28d1145b7..574fe4cc7 100644 --- a/.github/workflows/docker-build-publish-dev.yml +++ b/.github/workflows/docker-build-publish-dev.yml @@ -11,6 +11,9 @@ concurrency: jobs: ever-teams-webapp: runs-on: buildjet-8vcpu-ubuntu-2204 + + environment: dev + steps: - name: Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/docker-build-publish-prod.yml b/.github/workflows/docker-build-publish-prod.yml index efc2d0b75..ad4986543 100644 --- a/.github/workflows/docker-build-publish-prod.yml +++ b/.github/workflows/docker-build-publish-prod.yml @@ -11,6 +11,9 @@ concurrency: jobs: ever-teams-webapp: runs-on: buildjet-8vcpu-ubuntu-2204 + + environment: prod + steps: - name: Checkout uses: actions/checkout@v3