Skip to content

Commit

Permalink
Merge pull request #8617 from ever-co/develop
Browse files Browse the repository at this point in the history
Stage
  • Loading branch information
evereq authored Dec 24, 2024
2 parents 475da61 + c0187af commit 767f0ca
Show file tree
Hide file tree
Showing 4,348 changed files with 26,125 additions and 16,853 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 5 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,11 @@
"wdth",
"concate",
"typeahead",
"maxlength"
"maxlength",
"xplatframework",
"localforage",
"longform",
"rfdc"
],
"useGitignore": true,
"ignorePaths": [
Expand Down
58 changes: 47 additions & 11 deletions .deploy/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ ENV NODE_ENV=development
# Set Python interpreter for `node-gyp` to use
ENV PYTHON /usr/bin/python

RUN apk --update add bash && npm i -g npm \
RUN apk --update add bash && npm i -g npm@9 \
&& apk add --no-cache --virtual build-dependencies bind-tools curl tar xz jq python3 python3-dev py3-configobj py3-pip py3-setuptools build-base \
snappy libheif dos2unix gcc g++ snappy-dev git libgcc libstdc++ linux-headers autoconf automake make nasm vips-dev vips

Expand All @@ -143,7 +143,6 @@ COPY --chown=node:node apps/gauzy/package.json ./apps/gauzy/
COPY --chown=node:node apps/api/package.json ./apps/api/

COPY --chown=node:node packages/common/package.json ./packages/common/
COPY --chown=node:node packages/common-angular/package.json ./packages/common-angular/
COPY --chown=node:node packages/config/package.json ./packages/config/
COPY --chown=node:node packages/contracts/package.json ./packages/contracts/
COPY --chown=node:node packages/auth/package.json ./packages/auth/
Expand Down Expand Up @@ -182,8 +181,7 @@ COPY --chown=node:node packages/ui-auth/package.json ./packages/ui-auth/

COPY --chown=node:node decorate-angular-cli.js lerna.json package.json yarn.lock ./

RUN yarn install --network-timeout 1000000 --frozen-lockfile
# RUN apk del build-dependencies make gcc g++ python2 py2-setuptools vips-dev
RUN yarn install --network-timeout 1000000 --frozen-lockfile && yarn cache clean

FROM node:20.11.1-alpine3.19 AS prodDependencies

Expand All @@ -195,7 +193,7 @@ ARG NODE_ENV
# Set Python interpreter for `node-gyp` to use
ENV PYTHON /usr/bin/python

RUN apk --update add bash && npm i -g npm \
RUN apk --update add bash && npm i -g npm@9 \
&& apk add --no-cache --virtual build-dependencies bind-tools curl tar xz jq python3 python3-dev py3-configobj py3-pip py3-setuptools build-base \
snappy libheif dos2unix gcc g++ snappy-dev git libgcc libstdc++ linux-headers autoconf automake make nasm vips-dev vips

Expand Down Expand Up @@ -253,13 +251,17 @@ COPY --chown=node:node packages/ui-auth/package.json ./packages/ui-auth/
# We do not build here Wakatime plugin, because it used in Desktop Apps for now
# COPY --chown=node:node packages/plugins/integration-wakatime/package.json ./packages/plugins/integration-wakatime/

COPY --chown=node:node package.json yarn.lock ./
COPY --chown=node:node decorate-angular-cli.js lerna.json package.json yarn.lock ./

RUN yarn install --network-timeout 1000000 --frozen-lockfile --production
# RUN apk del build-dependencies make gcc g++ python2 py2-setuptools vips-dev
RUN yarn install --network-timeout 1000000 --frozen-lockfile --production && yarn cache clean

# We remove Angular modules as it's not used in APIs
RUN rm -r node_modules/@angular

# Exclude @gauzy directories before copying because we copy
# those within custom webpack in apps/api/config/custom-webpack.config.js
# RUN rm -r node_modules/@gauzy

FROM node:20.11.1-alpine3.19 AS development

USER node:node
Expand Down Expand Up @@ -289,7 +291,7 @@ ARG NODE_ENV
ARG DEMO
ARG NODE_OPTIONS

ENV NODE_OPTIONS=${NODE_OPTIONS:-"--max-old-space-size=30000"}
ENV NODE_OPTIONS=${NODE_OPTIONS:-"--max-old-space-size=60000"}
ENV NODE_ENV=${NODE_ENV}
ENV DEMO=${DEMO:-false}

Expand All @@ -299,19 +301,22 @@ ENV IS_DOCKER=true
ENV NX_NO_CLOUD=true

RUN if [ "$NODE_ENV" = "production" ]; then \
yarn build:package:api:prod; \
yarn build:package:api:docker; \
else \
yarn build:package:api; \
fi

RUN yarn build:api:prod:docker

# Exclude @gauzy directories before copying because we copy
# those within custom webpack in apps/api/config/custom-webpack.config.js
# RUN rm -r dist/apps/api/node_modules/@gauzy

FROM node:20.11.1-alpine3.19 AS production

WORKDIR /srv/gauzy

COPY --chown=node:node --from=dependencies /wait /entrypoint.prod.sh /entrypoint.compose.sh ./
COPY --chown=node:node --from=prodDependencies /srv/gauzy/node_modules/ ./node_modules/
COPY --chown=node:node --from=build /srv/gauzy/packages/ ./packages/

# Copy static assets files which used for example in the seeds (e.g. images for features, reports, screenshots)
Expand All @@ -327,6 +332,11 @@ COPY --chown=node:node apps/api/src/assets/seed apps/api/public

COPY --chown=node:node --from=build /srv/gauzy/dist/apps/api .

# Copy node_modules to a temporary location
COPY --chown=node:node --from=prodDependencies /srv/gauzy/node_modules /tmp/node_modules_temp
# Add a script to merge directories inside the container (skip files that already exists)
RUN cp -rn /tmp/node_modules_temp/* ./node_modules/ && rm -rf /tmp/node_modules_temp

RUN npm install pm2@4.5.1 -g && \
mkdir /import && chown node:node /import && \
touch ormlogs.log && chown node:node ormlogs.log && chown node:node wait && \
Expand All @@ -335,14 +345,40 @@ RUN npm install pm2@4.5.1 -g && \
# Clean up
RUN yarn cache clean

# we need node_modules inside each @gauzy package
RUN cp -r ./packages/auth/node_modules ./node_modules/@gauzy/auth/
RUN cp -r ./packages/common/node_modules ./node_modules/@gauzy/common/
RUN cp -r ./packages/config/node_modules ./node_modules/@gauzy/config/
RUN cp -r ./packages/contracts/node_modules ./node_modules/@gauzy/contracts/
RUN cp -r ./packages/core/node_modules ./node_modules/@gauzy/core/

RUN cp -r ./packages/plugins/changelog/node_modules ./node_modules/@gauzy/plugin-changelog/
RUN cp -r ./packages/plugins/integration-ai/node_modules ./node_modules/@gauzy/plugin-integration-ai/
RUN cp -r ./packages/plugins/integration-github/node_modules ./node_modules/@gauzy/plugin-integration-github/
RUN cp -r ./packages/plugins/integration-hubstaff/node_modules ./node_modules/@gauzy/plugin-integration-hubstaff/
RUN cp -r ./packages/plugins/integration-jira/node_modules ./node_modules/@gauzy/plugin-integration-jira/
RUN cp -r ./packages/plugins/integration-upwork/node_modules ./node_modules/@gauzy/plugin-integration-upwork/
RUN cp -r ./packages/plugins/integration-wakatime/node_modules ./node_modules/@gauzy/plugin-integration-wakatime/
RUN cp -r ./packages/plugins/jitsu-analytics/node_modules ./node_modules/@gauzy/plugin-jitsu-analytics/
RUN cp -r ./packages/plugins/job-proposal/node_modules ./node_modules/@gauzy/plugin-job-proposal/
RUN cp -r ./packages/plugins/job-search/node_modules ./node_modules/@gauzy/plugin-job-search/
RUN cp -r ./packages/plugins/knowledge-base/node_modules ./node_modules/@gauzy/plugin-knowledge-base/
RUN cp -r ./packages/plugins/product-reviews/node_modules ./node_modules/@gauzy/plugin-product-reviews/
RUN cp -r ./packages/plugins/sentry/node_modules ./node_modules/@gauzy/plugin-sentry/

# we don't need packages folder anymore
RUN rm -rf ./packages

USER node:node

ENV CI=true

ENV NODE_OPTIONS=${NODE_OPTIONS:-"--max-old-space-size=12288"}
ENV NODE_ENV=${NODE_ENV:-production}

ENV API_HOST=${API_HOST:-api}
ENV API_PORT=${API_PORT:-3000}

ENV API_BASE_URL=${API_BASE_URL:-http://localhost:3000}
ENV CLIENT_BASE_URL=${CLIENT_BASE_URL:-http://localhost:4200}
ENV SENTRY_DSN=${SENTRY_DSN}
Expand Down
33 changes: 27 additions & 6 deletions .deploy/webapp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,20 @@ LABEL org.opencontainers.image.source https://github.com/ever-co/ever-gauzy

ENV CI=true

RUN apk --update add bash && \
apk add --no-cache --virtual build-dependencies bind-tools curl tar xz jq python3 python3-dev py3-configobj py3-pip py3-setuptools dos2unix gcc g++ git make vips-dev && \
# We need to set to "development", because we are using "yarn install" below to setup
# devDependencies even for production builds!
ENV NODE_ENV=development

RUN apk --update add bash && npm i -g npm@9 \
&& apk add --no-cache --virtual build-dependencies bind-tools curl tar xz jq python3 python3-dev py3-configobj py3-pip py3-setuptools dos2unix gcc g++ git make vips-dev && \
mkdir /srv/gauzy && chown -R node:node /srv/gauzy

# Verify the Node.js version
RUN node --version
RUN npm --version

RUN npm install yarn -g --force

COPY wait .deploy/webapp/entrypoint.compose.sh .deploy/webapp/entrypoint.prod.sh .deploy/webapp/replacements.sed /

RUN chmod +x /wait /entrypoint.compose.sh /entrypoint.prod.sh && dos2unix /entrypoint.compose.sh && dos2unix /entrypoint.prod.sh
Expand All @@ -83,7 +89,6 @@ WORKDIR /srv/gauzy
COPY --chown=node:node apps/gauzy/package.json ./apps/gauzy/

COPY --chown=node:node packages/common/package.json ./packages/common/
COPY --chown=node:node packages/common-angular/package.json ./packages/common-angular/
COPY --chown=node:node packages/config/package.json ./packages/config/
COPY --chown=node:node packages/contracts/package.json ./packages/contracts/
COPY --chown=node:node packages/auth/package.json ./packages/auth/
Expand Down Expand Up @@ -122,8 +127,8 @@ COPY --chown=node:node packages/ui-auth/package.json ./packages/ui-auth/

COPY --chown=node:node decorate-angular-cli.js lerna.json package.json yarn.lock ./

# Must be without --production because we need dev deps installed
RUN yarn install --network-timeout 1000000 --frozen-lockfile && yarn cache clean
# RUN apk del build-dependencies make gcc g++ python2 py2-setuptools vips-dev

FROM node:20.11.1-alpine3.19 AS development

Expand All @@ -143,17 +148,28 @@ RUN mkdir dist

COPY --chown=node:node --from=development /srv/gauzy .

ENV NODE_OPTIONS=${NODE_OPTIONS:-"--max-old-space-size=30000"}
ENV CI=true

# We make NODE_ENV and other env vars passed as build argument to be available in this stage
ARG NODE_ENV
ARG DEMO
ARG NODE_OPTIONS

ENV NODE_OPTIONS=${NODE_OPTIONS:-"--max-old-space-size=60000"}
ENV NODE_ENV=${NODE_ENV:-production}
ENV DEMO=${DEMO:-false}

ENV IS_DOCKER=true

# Temporary disable caching in NX Cloud for builds
ENV NX_NO_CLOUD=true

RUN yarn build:package:gauzy
RUN yarn build:package:gauzy:docker
RUN yarn build:gauzy:prod:docker

# Clean up
RUN yarn cache clean

FROM nginx:alpine AS production

# USER nginx:nginx
Expand All @@ -168,6 +184,11 @@ COPY --chown=nginx:nginx --from=build /srv/gauzy/dist/apps/gauzy .
RUN chmod +x wait entrypoint.compose.sh entrypoint.prod.sh && \
chmod a+rw /etc/nginx/conf.d/compose.conf.template /etc/nginx/conf.d/prod.conf.template

ENV CI=true

ENV NODE_OPTIONS=${NODE_OPTIONS:-"--max-old-space-size=12288"}
ENV NODE_ENV=${NODE_ENV:-production}

ENV API_HOST=${API_HOST:-api}
ENV API_PORT=${API_PORT:-3000}

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/desktop-app-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

strategy:
matrix:
os: [buildjet-8vcpu-ubuntu-2204]
os: [buildjet-16vcpu-ubuntu-2204]

steps:
- name: Check out Git repository
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:

strategy:
matrix:
os: [macos-12]
os: [macos-latest]

steps:
- name: Check out Git repository
Expand All @@ -97,7 +97,7 @@ jobs:
cache: 'yarn'

- name: Fix node-gyp and Python
run: python3 -m pip install packaging setuptools
run: python3 -m pip install --break-system-packages packaging setuptools

- name: Install latest version of NPM
run: 'sudo npm install -g npm@9'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/desktop-app-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

strategy:
matrix:
os: [buildjet-8vcpu-ubuntu-2204]
os: [buildjet-16vcpu-ubuntu-2204]

steps:
- name: Check out Git repository
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:

strategy:
matrix:
os: [macos-12]
os: [macos-latest]

steps:
- name: Check out Git repository
Expand All @@ -97,7 +97,7 @@ jobs:
cache: 'yarn'

- name: Fix node-gyp and Python
run: python3 -m pip install packaging setuptools
run: python3 -m pip install --break-system-packages packaging setuptools

- name: Install latest version of NPM
run: 'sudo npm install -g npm@9'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/desktop-timer-app-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

strategy:
matrix:
os: [buildjet-8vcpu-ubuntu-2204]
os: [buildjet-16vcpu-ubuntu-2204]

steps:
- name: Check out Git repository
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:

strategy:
matrix:
os: [macos-12]
os: [macos-latest]

steps:
- name: Check out Git repository
Expand All @@ -97,7 +97,7 @@ jobs:
cache: 'yarn'

- name: Fix node-gyp and Python
run: python3 -m pip install packaging setuptools
run: python3 -m pip install --break-system-packages packaging setuptools

- name: Install latest version of NPM
run: 'sudo npm install -g npm@9'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/desktop-timer-app-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

strategy:
matrix:
os: [buildjet-8vcpu-ubuntu-2204]
os: [buildjet-16vcpu-ubuntu-2204]

steps:
- name: Check out Git repository
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:

strategy:
matrix:
os: [macos-12]
os: [macos-latest]

steps:
- name: Check out Git repository
Expand All @@ -97,7 +97,7 @@ jobs:
cache: 'yarn'

- name: Fix node-gyp and Python
run: python3 -m pip install packaging setuptools
run: python3 -m pip install --break-system-packages packaging setuptools

- name: Install latest version of NPM
run: 'sudo npm install -g npm@9'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-build-publish-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:

jobs:
gauzy-api:
runs-on: buildjet-8vcpu-ubuntu-2204
runs-on: buildjet-16vcpu-ubuntu-2204
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
# docker push ${{ secrets.CW_DOCKER_REGISTRY }}/ever-co/gauzy-api-demo:latest

gauzy-webapp:
runs-on: buildjet-8vcpu-ubuntu-2204
runs-on: buildjet-16vcpu-ubuntu-2204
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-build-publish-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:

jobs:
gauzy-api:
runs-on: buildjet-8vcpu-ubuntu-2204
runs-on: buildjet-16vcpu-ubuntu-2204
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
# docker push ${{ secrets.CW_DOCKER_REGISTRY }}/ever-co/gauzy-api:latest

gauzy-webapp:
runs-on: buildjet-8vcpu-ubuntu-2204
runs-on: buildjet-16vcpu-ubuntu-2204
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
Loading

0 comments on commit 767f0ca

Please sign in to comment.