refs #5739 feat: run test back & fix: docker network
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2024-01-04 15:45:15 +01:00
parent bd062adf2a
commit 07af295730
9 changed files with 37 additions and 35 deletions

View File

@ -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"]

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -1,6 +1,7 @@
FROM back
EXPOSE 5000
WORKDIR /salix
COPY /front/gulpfile.js ./
COPY /front/webpack.config.js ./
COPY /front/package.json ./front/

View File

@ -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

3
front/runTestFront.sh Normal file
View File

@ -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

View File

@ -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

View File

@ -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",