diff --git a/README.md b/README.md index 550e5db73b..8e4f865e66 100644 --- a/README.md +++ b/README.md @@ -28,49 +28,47 @@ Pull from repository. $ git clone [url] [directory] ``` + Run this commands on project root directory to install Node dependencies. ```sh $ sh init.sh ``` + Launch application in developer environment. ```sh $ docker compose -f docker-compose.local.yml up -``` -With NodeJS -```sh +# Or with NodeJS $ npm run start ``` -Manually reset fixtures. + +Manually reset fixtures if has changes. ```sh -$ docker compose -f docker-compose.local.yml up --build +$ sh db/reset.sh ``` -With NodeJS +Manually reset strucutre/fixtures always. ```sh -$ npm run restart +$ sh db/resetForce.sh ``` + ## Running the unit tests For client-side unit tests run from project's root. ```sh $ sh runTestFront.sh -``` -With NodeJS -```sh +# Or with NodeJS $ npm run test:front ``` For server-side unit tests run from project's root. ```sh $ sh runTestBack.sh -``` -With NodeJS -```sh +# Or with NodeJS $ npm run test:back ``` diff --git a/db/reset.sh b/db/reset.sh new file mode 100644 index 0000000000..76dca9cf58 --- /dev/null +++ b/db/reset.sh @@ -0,0 +1,3 @@ +docker compose -f docker-compose.local.yml down db +docker compose -f docker-compose.local.yml build db +docker compose -f docker-compose.local.yml up db -d diff --git a/db/resetForce.sh b/db/resetForce.sh new file mode 100644 index 0000000000..f150ef546c --- /dev/null +++ b/db/resetForce.sh @@ -0,0 +1,3 @@ +docker compose -f docker-compose.local.yml down db +docker compose -f docker-compose.local.yml build db --no-cache +docker compose -f docker-compose.local.yml up db -d diff --git a/docker-compose.local.yml b/docker-compose.local.yml index 7760726453..729fbb3d44 100644 --- a/docker-compose.local.yml +++ b/docker-compose.local.yml @@ -21,7 +21,8 @@ services: restart: unless-stopped build: context: . - dockerfile: front/Dockerfile.local + dockerfile: front/Dockerfile + target: local ports: - 5000:5000 depends_on: @@ -55,7 +56,3 @@ services: - ./node_modules:/salix/node_modules - ./print:/salix/print -networks: - salix-stack-network: - driver: host - diff --git a/docker-compose.test.yml b/docker-compose.test.yml index cf4f6556d5..ecc4a23121 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -12,7 +12,8 @@ services: command: ["npx", "jest", "--ci", "--maxWorkers=2"] build: context: . - dockerfile: front/Dockerfile.test + dockerfile: front/Dockerfile + target: test # depends_on: # - back back: @@ -27,13 +28,3 @@ services: - NODE_ENV depends_on: - db - e2e: - image: e2e - restart: always - build: - context: . - dockerfile: e2e/Dockerfile - environment: - - NODE_ENV - depends_on: - - front diff --git a/front/Dockerfile b/front/Dockerfile index d0ee269041..fa088d3d07 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -16,3 +16,37 @@ RUN rm sites-enabled/default && ln -s ../sites-available/salix sites-enabled/sal COPY dist /salix/dist CMD ["nginx", "-g", "daemon off;"] + +FROM back AS local +EXPOSE 5000 + +WORKDIR /salix +COPY /front/gulpfile.js ./ +COPY /front/webpack.config.js ./ +COPY /front/package.json ./front/ +# RUN cd front && npm install --ci + +CMD ["npx", "gulp", "front"] + +FROM back AS test +EXPOSE 5000 +WORKDIR /salix + +COPY front front +# RUN npm i -g jest +RUN cd front && npm install --ci + +COPY modules modules +# COPY dist dist +COPY jest-front.js ./ +COPY jest.front.config.js ./ +COPY babel.config.js ./ +COPY fileMock.js ./ + +COPY /front/gulpfile.js ./ +COPY /front/webpack.config.js ./ +COPY /front/salix ./front/salix +COPY /front/core ./front/core + +CMD ["npx", "gulp", "front"] + diff --git a/front/Dockerfile.local b/front/Dockerfile.local deleted file mode 100644 index 85dd0dacdb..0000000000 --- a/front/Dockerfile.local +++ /dev/null @@ -1,10 +0,0 @@ -FROM back -EXPOSE 5000 - -WORKDIR /salix -COPY /front/gulpfile.js ./ -COPY /front/webpack.config.js ./ -COPY /front/package.json ./front/ -# RUN cd front && npm install --ci - -CMD ["npx", "gulp", "front"] diff --git a/front/Dockerfile.test b/front/Dockerfile.test deleted file mode 100644 index 89af8f773f..0000000000 --- a/front/Dockerfile.test +++ /dev/null @@ -1,21 +0,0 @@ -FROM back -EXPOSE 5000 -WORKDIR /salix - -COPY front front -# RUN npm i -g jest -RUN cd front && npm install --ci - -COPY modules modules -# COPY dist dist -COPY jest-front.js ./ -COPY jest.front.config.js ./ -COPY babel.config.js ./ -COPY fileMock.js ./ - -COPY /front/gulpfile.js ./ -COPY /front/webpack.config.js ./ -COPY /front/salix ./front/salix -COPY /front/core ./front/core - -CMD ["npx", "gulp", "front"] diff --git a/package.json b/package.json index 5a8c11d926..663c8c53de 100644 --- a/package.json +++ b/package.json @@ -115,8 +115,7 @@ "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", - "start": "docker compose -f docker-compose.local.yml up", - "restart": "docker compose -f docker-compose.local.yml up --build" + "start": "docker compose -f docker-compose.local.yml up" }, "jest": { "projects": [ diff --git a/runTestE2E.sh b/runTestE2E.sh deleted file mode 100644 index 743f51884c..0000000000 --- a/runTestE2E.sh +++ /dev/null @@ -1,10 +0,0 @@ -docker-compose -p salix-test -f docker-compose.test.yml build --force-rm db -docker-compose -p salix-test -f docker-compose.test.yml build --force-rm back -docker-compose -p salix-test -f docker-compose.test.yml build --force-rm front -docker-compose -p salix-test -f docker-compose.test.yml build --force-rm e2e -docker-compose -p salix-test -f docker-compose.test.yml up db back --no-recreate -docker-compose -p salix-test -f docker-compose.test.yml up front -docker-compose -p salix-test -f docker-compose.test.yml run e2e #--rm -docker-compose -p salix-test -f docker-compose.test.yml rm -s -v -f -# docker-compose -p salix-test -f docker-compose.test.yml down -# docker-compose -p salix-test -f docker-compose.test.yml rm