From 5f20906349d3906c4185b95bee20d86c502c1054 Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Fri, 13 Jun 2025 16:49:30 +0200 Subject: [PATCH] docker: update .dockerignore for comprehensive exclusion of build artifacts and development files; modify Dockerfile for improved build process and cleanup; comment out npm install in prepare.sh for types library --- .dockerignore | 182 ++++++++++++++++++++++++++++++++++++++++++++-- docker/Dockerfile | 28 +++---- prepare.sh | 2 +- 3 files changed, 188 insertions(+), 24 deletions(-) diff --git a/.dockerignore b/.dockerignore index 7c0da1d..ee89308 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,177 @@ -**/node_modules -**/dist -**/.angular -**/.vscode -**/e2e +# ==================================================== +# NODE.JS & NPM +# ==================================================== +**/node_modules/ +**/npm-debug.log* +**/yarn-debug.log* +**/yarn-error.log* +**/lerna-debug.log* +**/.npm +**/.pnpm-debug.log* + +# ==================================================== +# BUILD OUTPUTS & DIST +# ==================================================== +**/dist/ +**/build/ +**/coverage/ +**/.nyc_output/ +**/lib-cov/ + +# # ==================================================== +# # ANGULAR SPECIFIC +# # ==================================================== +**/.angular/ + + +# ==================================================== +# TESTING & E2E +# ==================================================== +**/e2e/ +**/tests/screenshots/ +**/tests/videos/ +**/tests/results/ +**/test-results/ +**/playwright-report/ +**/test_localstorage_state.json +**/*_current.png +**/*_mask.png +**/*.spec.js.map +**/*.test.js.map +**/cypress/ +**/jest-coverage/ +**/.jest/ +**/testapp/ + +# ==================================================== +# DEVELOPMENT TOOLS & EDITORS +# ==================================================== +**/.vscode/ +**/.idea/ +**/.vs/ +**/.vscode-test/ +**/*.swp +**/*.swo +**/*~ +**/.DS_Store +**/Thumbs.db + +# ==================================================== +# GIT & VERSION CONTROL +# ==================================================== +**/.git/ +**/.gitignore +**/.gitattributes +**/.gitmodules + +# ==================================================== +# LOGS & TEMPORARY FILES +# ==================================================== +**/logs/ +**/*.log +**/tmp/ +**/temp/ +**/.tmp/ +**/.temp/ +**/pids/ +**/*.pid +**/*.seed +**/*.pid.lock + +# ==================================================== +# ENVIRONMENT & CONFIG +# ==================================================== +**/.env +**/.env.local +**/.env.development.local +**/.env.test.local +**/.env.production.local +**/.env.*.local + +# ==================================================== +# DOCUMENTATION & README +# ==================================================== +**/README.md +**/CHANGELOG.md +**/docs/ +**/documentation/ +**/*.md +**/webhooks-snippets/ + +# ==================================================== +# LINTING & FORMATTING +# ==================================================== +**/.eslintcache +**/.stylelintcache +**/.prettier* +**/.editorconfig + +# ==================================================== +# TYPESCRIPT +# ==================================================== +**/tsconfig.tsbuildinfo +**/*.tsbuildinfo + +# ==================================================== +# CI/CD & DEPLOYMENT +# ==================================================== +**/.github/ +**/.gitlab-ci.yml +**/.travis.yml +**/.circleci/ +**/jenkins/ +**/azure-pipelines.yml + +# ==================================================== +# CERTIFICATES & KEYS +# ==================================================== +**/*.pem +**/*.key +**/*.cert +**/*.p12 +**/*.crt + +# ==================================================== +# MEDIA & ASSETS (Large files) +# ==================================================== +**/*.mp4 +**/*.avi +**/*.mov +**/*.mkv +**/*.webm +**/*.mp3 +**/*.wav +**/*.flac + +# ==================================================== +# WORKSPACE & PROJECT FILES +# ==================================================== +**/*.code-workspace +**/.project +**/.classpath +**/.settings/ + +# ==================================================== +# CACHE FILES +# ==================================================== +**/.cache/ +**/cache/ +**/.parcel-cache/ +**/.next/ +**/.nuxt/ +**/.gatsby/ + +# ==================================================== +# BACKEND SPECIFIC +# ==================================================== +**/uploads/ +**/sessions/ +**/public/ + +# ==================================================== +# FRONTEND BUILD ARTIFACTS +# ==================================================== +**/webcomponent/dist/ +**/webcomponent/node_modules/ +**/frontend/dist/ +**/frontend/.angular/ diff --git a/docker/Dockerfile b/docker/Dockerfile index e1f5455..4d5aec0 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,41 +1,33 @@ # ==================================================== # Stage 1: builder # ==================================================== -FROM node:22.14.0-alpine3.21 AS builder +FROM node:22.16.0-alpine3.21 AS builder WORKDIR /app -RUN mkdir -p types frontend backend && chown -R node:node /app +RUN mkdir -p typings frontend backend && chown -R node:node /app USER node COPY --chown=node:node frontend/package*.json ./frontend/ COPY --chown=node:node backend/package*.json ./backend/ -COPY --chown=node:node types/package*.json ./types/ +COPY --chown=node:node typings/package*.json ./typings/ COPY --chown=node:node . . -WORKDIR /app/frontend - ARG BASE_HREF=/ -RUN npm install -# Sync types from the types package -RUN npm run types:sync -# Build the fronted for production -RUN npm run build:prod ${BASE_HREF} +# Prepare project +RUN chmod +x prepare.sh && \ + sh ./prepare.sh --typings --frontend --webcomponent --backend -WORKDIR /app/backend - -RUN npm install -# Sync types from the types package -RUN npm run types:sync -# Build the backend for production -RUN npm run build:prod +# Clean up +RUN rm -rf frontend/node_modules backend/node_modules && \ + rm -rf typings # ==================================================== # Stage 2: production # ==================================================== -FROM node:22.14.0-alpine3.21 AS production +FROM node:22.16.0-alpine3.21 AS production WORKDIR /opt/openvidu-meet diff --git a/prepare.sh b/prepare.sh index b5c45d2..23ff084 100755 --- a/prepare.sh +++ b/prepare.sh @@ -84,7 +84,7 @@ fi if [ "$BUILD_TYPINGS" = true ]; then echo -e "${GREEN}Building types library...${NC}" cd typings - npm install + # npm install npm run sync-ce cd .. fi