diff --git a/back/Dockerfile b/back/Dockerfile index 164a1d7b3..c37adc67f 100644 --- a/back/Dockerfile +++ b/back/Dockerfile @@ -20,41 +20,37 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends \ samba-common-bin samba-dsdb-modules\ && rm -rf /var/lib/apt/lists/* -# RUN apt update && apt install -y chromium-browser chromium-chromedriver +RUN npm i -g gulp-cli +# RUN npm i -g bun + +# RUN apt update && apt install -y chromium-browser chromium-chromedriver # RUN curl -fsSL https://bun.sh/install | bash -# Salix WORKDIR /salix -# COPY package.json package-lock.json ./ -# COPY loopback/package.json loopback/ -# COPY print/package.json print/ -# # RUN npm install -# # RUN npm install -# # RUN npm --prefix ./print install ./print - COPY print/package.json print/package-lock.json print/ -RUN npm --prefix ./print install ./print - -COPY package.json package-lock.json ./ COPY loopback/package.json loopback/ -RUN npm install - +COPY package.json package-lock.json ./ COPY gulpfile.js ./ COPY \ LICENSE \ README.md \ ./ +# RUN bun --prefix ./print install ./print FROM base AS local +WORKDIR /salix +RUN cd ./print && npx puppeteer browsers install chrome CMD ["npx", "gulp", "backWatch"] - FROM base AS test +WORKDIR /salix +RUN cd ./print && npx puppeteer browsers install chrome COPY loopback loopback +RUN npm i COPY back back COPY modules modules COPY print print @@ -62,4 +58,3 @@ COPY storage storage # CMD ["npx", "gulp", "backOnly"] CMD ["npm", "run", "test:back:ci"] - diff --git a/back/runTestBack.sh b/back/runTestBack.sh index 0edf1eeb4..1c05e60d6 100644 --- a/back/runTestBack.sh +++ b/back/runTestBack.sh @@ -1,2 +1,4 @@ -docker-compose -p salix-test -f docker-compose.test.yml build --no-cache back db +docker-compose -p salix-test -f docker-compose.test.yml build --force-rm back db docker-compose -p salix-test -f docker-compose.test.yml run --rm back +docker-compose -p salix-test -f docker-compose.test.yml down +docker-compose -p salix-test -f docker-compose.test.yml rm diff --git a/docker-compose.local.yml b/docker-compose.local.yml index efd6d7abb..9560ed267 100644 --- a/docker-compose.local.yml +++ b/docker-compose.local.yml @@ -8,7 +8,7 @@ services: # volumes: # - .:/salix db: - image: db + image: db:local restart: unless-stopped build: context: db @@ -17,6 +17,7 @@ services: - 3306:3306 front: image: front + command: ["npx", "gulp", "front"] restart: unless-stopped build: context: . @@ -30,9 +31,11 @@ services: - ./dist:/salix/dist - ./front:/salix/front - ./loopback:/salix/loopback + - ./node_modules:/salix/node_modules back: image: back + command: ["npx", "gulp", "backWatch"] restart: unless-stopped build: context: . @@ -50,8 +53,8 @@ services: - ./storage:/salix/storage - ./modules:/salix/modules - ./back:/salix/back - # - ./node_modules:/salix/node_modules - # - ./print:/salix/print + - ./node_modules:/salix/node_modules + - ./print:/salix/print networks: salix-stack-network: diff --git a/docker-compose.test.yml b/docker-compose.test.yml index b9d449b45..a1441d2d3 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -13,13 +13,15 @@ services: # volumes: # - ./print:/salix/print db: - image: salix-db:test + image: db:test restart: always build: context: db dockerfile: Dockerfile + ports: + - 3306:3306 front: - image: salix-front + image: front restart: always command: ["npm", "run", "test:front:ci"] build: @@ -28,7 +30,7 @@ services: depends_on: - back back: - image: salix-back + image: back restart: always build: context: . @@ -38,14 +40,8 @@ services: - NODE_ENV depends_on: - db - - node_modules - - print - volumes: - - ./node_modules:/salix/node_modules - - ./print/node_modules:/salix/print/node_modules - networks: - salix-stack-network: + stack-network: driver: host diff --git a/front/Dockerfile.local b/front/Dockerfile.local index 7e508362f..85dd0dacd 100644 --- a/front/Dockerfile.local +++ b/front/Dockerfile.local @@ -1,6 +1,7 @@ FROM back EXPOSE 5000 +WORKDIR /salix COPY /front/gulpfile.js ./ COPY /front/webpack.config.js ./ COPY /front/package.json ./front/ diff --git a/front/Dockerfile.test b/front/Dockerfile.test index 9725a4bdf..59ccd4112 100644 --- a/front/Dockerfile.test +++ b/front/Dockerfile.test @@ -1,7 +1,8 @@ -FROM salix-back +FROM back EXPOSE 5000 COPY front front +RUN npm i -g jest RUN cd front && npm install --ci COPY modules modules diff --git a/front/runTestFront.sh b/front/runTestFront.sh new file mode 100644 index 000000000..881e6e079 --- /dev/null +++ b/front/runTestFront.sh @@ -0,0 +1,3 @@ +docker-compose -p salix-test -f docker-compose.test.yml run --rm front +docker-compose -p salix-test -f docker-compose.test.yml down +docker-compose -p salix-test -f docker-compose.test.yml rm diff --git a/init.sh b/init.sh index 22a487bbb..f481c716f 100644 --- a/init.sh +++ b/init.sh @@ -1 +1,2 @@ -docker run --rm -v $(pwd):/app -w /app node:20-bullseye-slim npm install +# docker run --rm -v $(pwd):/app -w /app node:20-bullseye-slim npm install +docker network create --driver=host salix-stack-network diff --git a/package.json b/package.json index 48554d7d0..18632e00b 100644 --- a/package.json +++ b/package.json @@ -109,10 +109,10 @@ "scripts": { "dbtest": "nodemon -q db/tests.js -w db/tests", "test:back": "sh back/runTestBack.sh", - "test:back:ci": "node back/tests.js ci", + "test:back:ci": "sh back/runTestBack.sh", "test:e2e": "node e2e/helpers/tests.js", - "test:front": "docker compose -f docker-compose.test.yml up front --build", - "test:front:ci": "jest --ci --maxWorkers=2", + "test:front": "sh front/runTestFront.sh", + "test:front:ci": "jest --ci --maxWorkers=2", "back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back", "lint": "eslint ./ --cache --ignore-pattern .gitignore", "docker": "docker build --progress=plain -t salix-db ./db",