diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..01c8b1b48 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +**/node_modules +**/build +**/coverage \ No newline at end of file diff --git a/.github/workflows/test_admin_interface.yml b/.github/workflows/test_admin_interface.yml index 160c819d2..d57c78ef8 100644 --- a/.github/workflows/test_admin_interface.yml +++ b/.github/workflows/test_admin_interface.yml @@ -33,7 +33,7 @@ jobs: uses: actions/checkout@v3 - name: Admin Interface | Build 'test' image - run: docker build --target test -t "gradido/admin:test" admin/ --build-arg NODE_ENV="test" + run: docker build -f ./admin/Dockerfile --target test -t "gradido/admin:test" --build-arg NODE_ENV="test" . unit_test: if: needs.files-changed.outputs.admin == 'true' diff --git a/.github/workflows/test_backend.yml b/.github/workflows/test_backend.yml index ed20f91bb..96415cfff 100644 --- a/.github/workflows/test_backend.yml +++ b/.github/workflows/test_backend.yml @@ -44,7 +44,7 @@ jobs: uses: actions/checkout@v3 - name: Backend | docker-compose mariadb - run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mariadb + run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mariadb mailserver - name: Sleep for 30 seconds run: sleep 30s @@ -54,7 +54,7 @@ jobs: run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database - name: Backend | Unit tests - run: cd database && yarn && yarn build && cd ../backend && yarn && yarn test + run: cd database && yarn && yarn build && cd ../config && yarn install && cd ../backend && yarn && yarn test lint: if: needs.files-changed.outputs.backend == 'true' @@ -66,7 +66,7 @@ jobs: uses: actions/checkout@v3 - name: Backend | Lint - run: cd database && yarn && cd ../backend && yarn && yarn run lint + run: cd database && yarn && cd ../config && yarn install && cd ../backend && yarn && yarn run lint locales: if: needs.files-changed.outputs.backend == 'true' diff --git a/.github/workflows/test_dht_node.yml b/.github/workflows/test_dht_node.yml index 5452d3f0b..2bbbd5e6d 100644 --- a/.github/workflows/test_dht_node.yml +++ b/.github/workflows/test_dht_node.yml @@ -51,7 +51,7 @@ jobs: uses: actions/checkout@v3 - name: Lint - run: cd database && yarn && cd ../dht-node && yarn && yarn run lint + run: cd database && yarn && cd ../config && yarn install && cd ../dht-node && yarn && yarn run lint unit_test: name: Unit Tests - DHT Node diff --git a/.github/workflows/test_e2e.yml b/.github/workflows/test_e2e.yml index 48aff9c0b..3fb92562c 100644 --- a/.github/workflows/test_e2e.yml +++ b/.github/workflows/test_e2e.yml @@ -21,6 +21,8 @@ jobs: sudo chown runner:docker -R * cd database yarn && yarn dev_reset + cd ../config + yarn install cd ../backend yarn && yarn seed diff --git a/.github/workflows/test_frontend.yml b/.github/workflows/test_frontend.yml index 44137216b..208607fbd 100644 --- a/.github/workflows/test_frontend.yml +++ b/.github/workflows/test_frontend.yml @@ -33,7 +33,7 @@ jobs: uses: actions/checkout@v3 - name: Frontend | Build 'test' image - run: docker build --target test -t "gradido/frontend:test" frontend/ --build-arg NODE_ENV="test" + run: docker build -f ./frontend/Dockerfile --target test -t "gradido/frontend:test" --build-arg NODE_ENV="test" . unit_test: if: needs.files-changed.outputs.frontend == 'true' diff --git a/admin/Dockerfile b/admin/Dockerfile index a01903cc3..7d06b8251 100644 --- a/admin/Dockerfile +++ b/admin/Dockerfile @@ -11,7 +11,7 @@ ENV BUILD_DATE="1970-01-01T00:00:00.00Z" ## We cannot do $(npm run version).${BUILD_NUMBER} here so we default to 0.0.0.0 ENV BUILD_VERSION="0.0.0.0" ## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 -ENV BUILD_COMMIT="0000000" +ENV BUILD_COMMIT_SHORT="0000000" ## SET NODE_ENV ARG NODE_ENV="production" ## App relevant Envs @@ -42,6 +42,8 @@ EXPOSE ${PORT} RUN mkdir -p ${DOCKER_WORKDIR} WORKDIR ${DOCKER_WORKDIR} +RUN mkdir -p /config + ################################################################################## # DEVELOPMENT (Connected to the local environment, to reload on demand) ########## ################################################################################## @@ -53,7 +55,7 @@ FROM base as development # Run command # (for development we need to execute yarn install since the # node_modules are on another volume and need updating) -CMD /bin/sh -c "yarn install && yarn run dev" +CMD /bin/sh -c "cd /config && yarn install && cd /app && yarn && yarn run dev" ################################################################################## # BUILD (Does contain all files and is therefore bloated) ######################## @@ -61,9 +63,16 @@ CMD /bin/sh -c "yarn install && yarn run dev" FROM base as build # Copy everything -COPY . . -# yarn install +COPY ./admin/ . +# Copy everything from config +COPY ./config/ ../config/ + +# yarn install and build config +RUN cd ../config && yarn install --production=false --frozen-lockfile --non-interactive && yarn build + +# yarn install admin RUN yarn install --production=false --frozen-lockfile --non-interactive + # yarn build RUN yarn run build @@ -85,6 +94,7 @@ FROM base as production # Copy "binary"-files from build image COPY --from=build ${DOCKER_WORKDIR}/build ./build +COPY --from=build ${DOCKER_WORKDIR}/../config/build ../config/build # We also copy the node_modules express and serve-static for the run script COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules # Copy static files diff --git a/admin/package.json b/admin/package.json index 878eae220..b6943dde2 100644 --- a/admin/package.json +++ b/admin/package.json @@ -74,6 +74,8 @@ "eslint-plugin-prettier": "5.2.1", "eslint-plugin-promise": "^5.1.1", "eslint-plugin-vue": "8.7.1", + "gradido-config": "../config", + "joi": "^17.13.3", "jsdom": "^25.0.0", "mock-apollo-client": "^1.2.1", "postcss": "^8.4.8", diff --git a/admin/src/components/ContributionMessages/ContributionMessagesFormular.spec.js b/admin/src/components/ContributionMessages/ContributionMessagesFormular.spec.js index a64a7dfe9..fdf562a80 100644 --- a/admin/src/components/ContributionMessages/ContributionMessagesFormular.spec.js +++ b/admin/src/components/ContributionMessages/ContributionMessagesFormular.spec.js @@ -21,6 +21,7 @@ vi.mock('@vue/apollo-composable', () => ({ vi.mock('vue-i18n', () => ({ useI18n: () => ({ + locale: { value: 'en' }, t: (key) => key, }), })) diff --git a/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue b/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue index 8713f5f27..0ae31c905 100644 --- a/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue +++ b/admin/src/components/ContributionMessages/ContributionMessagesFormular.vue @@ -9,7 +9,13 @@
- +
@@ -80,9 +86,9 @@