diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 1629a979b6..04192920ee 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -40,6 +40,7 @@ services: dockerfile: Dockerfile processor: + user: root build: context: processor/ dockerfile: Dockerfile diff --git a/processor/Dockerfile b/processor/Dockerfile index 0ab20e568e..2ff4ecebe9 100644 --- a/processor/Dockerfile +++ b/processor/Dockerfile @@ -33,4 +33,3 @@ RUN addgroup --gid 1000 node && \ USER node CMD ["node", "dist/src/server.js"] - diff --git a/scripts/clear_volumes_and_test_processor.sh b/scripts/clear_volumes_and_test_processor.sh index 51e70fc9fc..290dbf7ce3 100755 --- a/scripts/clear_volumes_and_test_processor.sh +++ b/scripts/clear_volumes_and_test_processor.sh @@ -20,8 +20,11 @@ docker-compose down -v # you can pass arguments to mocha e.g. `-g multi` args="$(concatenate_args "$@")" + +# We need to install packages, compile ts, and move assets before running the actual testing code. +# The `node` user doesn't have permission to do any of these tasks. docker-compose run \ - -u node \ + -u root \ -e LOG_LEVEL=debug \ -e DATA_DIR=/data/test \ - processor sh -c "whoami && stat /data /gitea-data /app" + processor sh -c "yarn install && yarn tsc && yarn cp-assets && yarn cp-test-assets && yarn test ${args}"