diff --git a/.eslintrc.js b/.eslintrc.js index 3f197cb..c0f040d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -35,8 +35,23 @@ module.exports = { 'max-classes-per-file': 'off', 'no-use-before-define': 'off', 'vue/multi-word-component-names': 'off', + '@typescript-eslint/no-unused-vars': ['warn', { + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_', + }], + 'vue/no-v-for-template-key': 'off', + 'vue/html-button-has-type': 'off', + 'vue/no-template-target-blank': 'off', }, parserOptions: { parser: '@typescript-eslint/parser', }, + settings: { + 'import/resolver': { + typescript: { + project: './tsconfig.json', + }, + }, + }, } diff --git a/Dockerfile b/Dockerfile index eb3ca2a..fa6aed2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ###### BUILD STAGE ###### # https://v2.vuejs.org/v2/cookbook/dockerize-vuejs-app.html -FROM node:16-alpine AS build-stage +FROM node:20-alpine AS build-stage WORKDIR /app # install-layer @@ -26,10 +26,8 @@ COPY --from=build-stage /app/src/scss src/scss COPY --from=build-stage /app/src/components src/components COPY --from=build-stage /app/src/views src/views COPY --from=build-stage /app/node_modules/bootstrap/scss src/~bootstrap/scss -COPY --from=build-stage /app/node_modules/bootstrap-vue/src src/~bootstrap-vue/src +COPY --from=build-stage /app/node_modules/bootstrap-vue-next/src src/~bootstrap-vue-next/src COPY --from=build-stage /app/node_modules/prismjs/themes src/~prismjs/themes -COPY --from=build-stage /app/node_modules/vue-select/src/scss src/~vue-select/src/scss -COPY --from=build-stage /app/node_modules/vue2-datepicker/scss src/~vue2-datepicker/scss # nginx COPY nginx/default.conf /etc/nginx/conf.d/default.conf diff --git a/README.md b/README.md index 075a53b..7dde9b7 100644 --- a/README.md +++ b/README.md @@ -17,15 +17,26 @@ Install dependencies using: $ npm install ``` -Create `public/config.js` file. For local development, you need to set the apiURL to where the FDP server is running, usually: +### Local development (no Docker) + +1) Start the FDP server (default `http://localhost:8080`). +2) Create `public/config.js` and set `apiURL` to the FDP server: ```js // public/config.js window.config = { - apiURL: 'http://localhost:8080' + apiURL: 'http://localhost:8080', } ``` +3) Run the dev server: + +``` +$ npm run serve +``` + +The client will be available at `http://localhost:8081`. + > **Tip:** If you run both, the server and the client locally, start the server first, because it needs to run on port 8080. The client will then be automatically started on port 8081. Compile and hot-reload for development: @@ -40,6 +51,37 @@ Compile and minify for production: $ npm run build ``` +## Docker + +The nginx container can be configured at runtime using environment variables: + +- `API_URL` (optional): browser-facing API base URL. For Docker, use `/` to call same-origin and avoid CORS/internal DNS issues. +- `FDP_HOST` (required for Docker proxy): backend `host:port` used by nginx inside the container network. Do not include `http://` or `https://`. +- `FDP_SCHEME` (optional): `http` or `https` for the proxy (`http` default). +- `PUBLIC_PATH` (optional): base path if serving under a subpath (e.g. `/app`). +- `REBUILD_STYLES` (optional): set to any value to force rebuilding SCSS at container start. + +Example: backend is another container on the same network (`fdp` service): + +``` +docker run --rm -p 8081:80 \ + --network fdppv1_default \ + -e FDP_HOST=fdp:8080 \ + -e API_URL=/ \ + fdp-client +``` + +Example: backend is on host machine: + +``` +docker run --rm -p 8081:80 \ + -e FDP_HOST=host.docker.internal:8080 \ + -e API_URL=/ \ + fdp-client +``` + +If the backend is HTTPS-only, set `FDP_SCHEME=https` and ensure the API URL is `https://...`. + Run tests or linter: ``` diff --git a/public/index.html b/index.html similarity index 77% rename from public/index.html rename to index.html index 9d6c912..8bb98d3 100644 --- a/public/index.html +++ b/index.html @@ -5,8 +5,8 @@ - - + +