diff --git a/.deploy/api/Dockerfile b/.deploy/api/Dockerfile index addd7aed15d..9be3df3b880 100644 --- a/.deploy/api/Dockerfile +++ b/.deploy/api/Dockerfile @@ -182,7 +182,6 @@ 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 FROM node:20.11.1-alpine3.19 AS prodDependencies @@ -344,8 +343,10 @@ 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} diff --git a/.deploy/webapp/Dockerfile b/.deploy/webapp/Dockerfile index 200831c6183..31090b5862c 100644 --- a/.deploy/webapp/Dockerfile +++ b/.deploy/webapp/Dockerfile @@ -64,7 +64,11 @@ LABEL org.opencontainers.image.source https://github.com/ever-co/ever-gauzy ENV CI=true -RUN apk --update add bash && \ +# 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 @@ -72,6 +76,8 @@ RUN apk --update add bash && \ 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 @@ -142,8 +148,16 @@ RUN mkdir dist COPY --chown=node:node --from=development /srv/gauzy . +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 @@ -167,6 +181,14 @@ 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 +# Clean up +RUN yarn cache clean + +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}