chore(docker): remove unnecessary commands from setup.sh (#2157)

* There's already an nginx user in the container
* Join chowns into a single statement
* Remove ``--ignore-scripts``, in an attempt to fix arm (unsuccessfully)

The chances of exploting ignore scripts (initially proposed by SonarCloud) is really low:

* It runs into a container
* The container is 99% of the times built in GiHub Actions environment.

It also introduces a mismatch between lint and typecheck commands and most dev environments (not everyone runs npm with that flag enabled).
This commit is contained in:
Fernando Fernández 2023-12-05 19:40:33 +01:00 committed by GitHub
parent 9faa72a102
commit ca75e3a5d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 8 deletions

View File

@ -14,7 +14,7 @@ COPY frontend /app/frontend
WORKDIR /app/frontend
# Install dependencies
RUN npm ci --no-audit --ignore-scripts
RUN npm ci --no-audit
# Build client
RUN COMMIT_HASH=$(git rev-parse HEAD) npm run build

View File

@ -15,14 +15,9 @@ rm -rf /usr/lib/libcrypto* /usr/lib/libintl* /usr/lib/libssl* \
/usr/lib/engines-3 /usr/lib/modules-load.d /usr/lib/nginx /usr/lib/ossl-modules
# CONTAINER ROOTLESS SETUP
## Adding a nginx user that will manage the daemon
adduser --system --shell /bin/false --no-create-home --disabled-login --disabled-password --gecos "nginx user" --group nginx
## Set correct permissions
chown nginx:nginx -R /var/cache/nginx
### Set correct permissions and make frontend config.json file editable for the runtime user
mkdir -p /run/nginx
chown nginx:nginx -R /run/nginx
chown nginx:nginx -R /run/nginx /var/cache/nginx /usr/share/nginx/html/config.json
sed -i 's|/var/run|/var/run/nginx|g' $NGINX_CONFIG_FILE
## Make frontend config.json file editable for the runtime user
chown nginx:nginx -R /usr/share/nginx/html/config.json
## The 'user' config option is useless when running rootless and gives a warning
sed -i '/^user /d' $NGINX_CONFIG_FILE