Fix image not running in K8s (ROSA) (#24)

Fix image not running in K8s (ROSA)

Trying to solve the container exiting with error code `243`. `npm` throws `243` for any command you try to run with it.

Here is how to get into the container while the entrypoint normally errors.
```
$ oc run -i --tty --image=ghcr.io/matrix-org/matrix-public-archive/matrix-public-archive:sha-65edaea1a9713bb2cc93fa98638327fdeff765cd mpa-test2 --port=3050 --restart=Never --env="DOMAIN=cluster" --command /bin/bash
$ npm start

$ echo $?
243
```

Why does the same image work in Docker?
```
$ docker run -it --entrypoint /bin/bash ghcr.io/matrix-org/matrix-public-archive/matrix-public-archive:sha-65edaea1a9713bb2cc93fa98638327fdeff765cd
$ npm start
# it starts 
```


## Root cause

Seems like it could be either of these issues. Both are `8.6.0`+ problems as well which lines up with the `npm` version available in each base image.

 - https://github.com/npm/cli/issues/4769
 - https://github.com/npm/cli/issues/4996
    - Specific comment about breaking stuff in k8s for other people, https://github.com/npm/cli/issues/4996#issuecomment-1150290804
This commit is contained in:
Eric Eastwood 2022-06-15 18:42:15 -05:00 committed by GitHub
parent bd5c14242e
commit 724c562d6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -1,11 +1,13 @@
FROM node:16.15-buster-slim # XXX: Before updating this, make sure the issues around `npm` silently exiting
# with error 243 issues are solved:
# - https://github.com/npm/cli/issues/4996
# - https://github.com/npm/cli/issues/4769
FROM node:16.14.2-buster-slim
RUN mkdir -p /app RUN mkdir -p /app
WORKDIR /app WORKDIR /app
RUN npm install npm@^8 --location=global
# Copy the health-check script # Copy the health-check script
COPY docker-health-check.js /app/ COPY docker-health-check.js /app/