refs #5739 refactor: front/docker and readme
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2024-01-16 15:09:06 +01:00
parent 1cc4890e6d
commit 280e3c6760
10 changed files with 56 additions and 72 deletions

View File

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

3
db/reset.sh Normal file
View File

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

3
db/resetForce.sh Normal file
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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