From 60a1464db52e48a734819c341b17f2af8aa6e9b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Banno-Cloutier?= <leo.banno-cloutier@savoirfairelinux.com> Date: Fri, 9 Jun 2023 15:26:58 -0400 Subject: [PATCH] Dockerfile: no more reliance on the local environment Change-Id: I2b16ba10b7541fc6003f210c893654f41b7a7bc9 --- .dockerignore | 8 ++++++++ Dockerfile | 33 ++++++++++++++++++++++++++++----- README.md | 17 +++++++++++++---- jams-react-client/.eslintrc.js | 3 +++ jams-react-client/jsconfig.json | 2 +- jams-react-client/package.json | 21 ++++++--------------- 6 files changed, 59 insertions(+), 25 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..e4c71e6e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.git +.gitignore + +.dockerignore + +**/node_modules + +jams diff --git a/Dockerfile b/Dockerfile index 591b5571..0d6818ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,32 @@ -FROM adoptopenjdk/openjdk11:jdk-11.0.2.9-alpine +FROM maven:3.9.2-eclipse-temurin-11-alpine as build +RUN apk update && apk add --no-cache python3 npm + +WORKDIR /app/jams-react-client +COPY jams-react-client/package*.json ./ +RUN npm install -WORKDIR /opt/jams -COPY jams/*.jar ./ -COPY jams/libs libs/ -ADD jams/libs libs/ +WORKDIR /app +COPY pom.xml . +COPY ad-connector/pom.xml ad-connector/pom.xml +COPY authentication-module/pom.xml authentication-module/pom.xml +COPY datastore/pom.xml datastore/pom.xml +COPY jami-dht/pom.xml jami-dht/pom.xml +COPY jami-nameserver/pom.xml jami-nameserver/pom.xml +COPY jams-ca/pom.xml jams-ca/pom.xml +COPY jams-common/pom.xml jams-common/pom.xml +COPY jams-launcher/pom.xml jams-launcher/pom.xml +COPY ldap-connector/pom.xml ldap-connector/pom.xml +COPY jams-server/pom.xml jams-server/pom.xml +# RUN mvn verify --fail-never +# RUN mvn dependency:resolve --fail-never +RUN mvn dependency:go-offline --fail-never +COPY . . +# RUN mvn clean package +RUN mvn package + +FROM adoptopenjdk/openjdk11:jdk-11.0.2.9-alpine +WORKDIR /app +COPY --from=build /app/jams . EXPOSE 8080 ENTRYPOINT ["java","-jar","jams-launcher.jar"] diff --git a/README.md b/README.md index a666bd5c..1c7567a4 100644 --- a/README.md +++ b/README.md @@ -10,18 +10,25 @@ Clone the contents of this repository and run ``` +cd jams-react-client +npm install +npm start +cd .. mvn clean package ``` This will create a distribution folder called `jams` in the root folder. You can then launch the server by running -`java -jar jams-launcher` +``` +cd jams +java -jar jams-launcher.jar +``` If you want to start the server with an SSL certificate and on a port different from 8080, then run: -`java -jar jams-launcher 8443 server.pem server.key` +`java -jar jams-launcher.jar 8443 server.pem server.key` Where the `pem` and `key` files are a pem encoded certificate and key. @@ -40,6 +47,8 @@ To build the documentation, change enter the `jams-server` directory and simply `apidoc -i src/ -o doc/` +You can then open `doc/index.html`. Click on 1.0.0 in the top right corner if the doc doesn't appear. + ##### Building the Docker container You can build the docker container using: @@ -48,8 +57,8 @@ You can build the docker container using: docker build -f Dockerfile -t jams:latest . ``` -To run the docker container (assuming you want to have it on port 80 locally): +To run the docker container (assuming you want to have it on port 8080 locally): ``` -docker run -p 80:8080 --rm jams:latest +docker run -p 8080:8080 --rm jams:latest ``` diff --git a/jams-react-client/.eslintrc.js b/jams-react-client/.eslintrc.js index e254df4e..825c0826 100644 --- a/jams-react-client/.eslintrc.js +++ b/jams-react-client/.eslintrc.js @@ -18,4 +18,7 @@ module.exports = { "plugin:react/recommended", "plugin:prettier/recommended", ], + rules: { + "react/prop-types": "off", + }, }; diff --git a/jams-react-client/jsconfig.json b/jams-react-client/jsconfig.json index 256380f5..7057df91 100644 --- a/jams-react-client/jsconfig.json +++ b/jams-react-client/jsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "baseUrl": "src", "paths": { - "*": ["src/*"] + "*": ["./src/*"] } } } diff --git a/jams-react-client/package.json b/jams-react-client/package.json index e7d90b82..5dffbf29 100644 --- a/jams-react-client/package.json +++ b/jams-react-client/package.json @@ -5,7 +5,6 @@ "private": false, "main": "dist/index.js", "dependencies": { - "@lingui/react": "^2.9.2", "@material-ui/core": "4.12.1", "@material-ui/icons": "4.9.1", "@material-ui/lab": "^4.0.0-alpha.56", @@ -22,16 +21,14 @@ "image-to-base64": "^2.1.1", "lodash": "^4.17.19", "material-ui-popup-state": "^1.6.1", - "notistack": "^0.9.17", - "package.json": "^2.0.1", "perfect-scrollbar": "1.5.0", "prop-types": "15.7.2", "react": "^16.13.1", - "react-chartist": "0.14.3", + "react-color": "^2.19.3", "react-copy-to-clipboard": "^5.0.2", "react-dom": "16.13.1", + "react-dropzone": "^14.2.3", "react-easy-crop": "^3.1.1", - "react-google-maps": "9.4.5", "react-i18next": "^11.7.3", "react-image-file-resizer": "^0.3.8", "react-intl": "5.0.2", @@ -43,12 +40,12 @@ "yup-phone": "^1.2.3" }, "scripts": { - "start": "NODE_PATH=./src react-scripts start", - "build": "react-scripts build && ./node_modules/.bin/i18next-scanner", + "start": "export SET NODE_OPTIONS=--openssl-legacy-provider && NODE_PATH=./src react-scripts start", + "build": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts build && ./node_modules/.bin/i18next-scanner", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject", "install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start", - "format": "prettier --write \"src/**/*\"", + "format": "prettier --write --loglevel warn 'src/**/*.js'", "lint:check": "eslint . --ext=js,jsx; exit 0", "lint:fix": "eslint . --ext=js,jsx --fix; exit 0", "build-package-css": "cp src/assets/css/material-dashboard-react.css dist/material-dashboard-react.css", @@ -64,17 +61,11 @@ "bugs": { "url": "https://github.com/creativetimofficial/material-dashboard-react/issues" }, - "homepage": "https://creativetimofficial.github.io/material-dashboard-react/#/dashboard", "optionalDependencies": { - "@types/googlemaps": "3.39.6", - "@types/markerclustererplus": "2.1.33", - "ajv": "6.12.2", "typescript": "3.9.3" }, "devDependencies": { "@babel/core": "^7.11.6", - "@lingui/cli": "^2.9.2", - "@lingui/macro": "^2.9.2", "babel-core": "^7.0.0-bridge.0", "babel-plugin-i18next-extract": "^0.8.0", "eslint-config-prettier": "6.11.0", @@ -84,7 +75,7 @@ "i18next-parser": "^3.3.0", "i18next-scanner": "^2.11.0", "prettier": "2.0.5", - "webpack-cli": "^3.3.12" + "react-error-overlay": "^6.0.9" }, "browserslist": { "production": [ -- GitLab