Skip to content

Commit d78055e

Browse files
authored
Run mlx-ui as non-root user (#339)
Closes #337 Signed-off-by: Christian Kadner <[email protected]>
1 parent 5f41510 commit d78055e

File tree

4 files changed

+5859
-3160
lines changed

4 files changed

+5859
-3160
lines changed

dashboard/origin-mlx/Dockerfile

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# base image
2-
FROM node:14-slim
2+
FROM node:16-slim
33

44
# create app directory
55
RUN mkdir -p /workspace
@@ -12,11 +12,27 @@ ENV PORT=3000
1212

1313
# install and cache app dependencies
1414
COPY . /workspace
15+
1516
RUN npm install --silent --only=prod
1617

1718
# install and build UI backend
1819
RUN cd server && npm install && npm run build
1920

20-
# start app
21+
# make sure non-root user can modify workspace folder
22+
#RUN chgrp -R 0 /workspace && chmod -R g=u /workspace
23+
RUN chown -R node /workspace
24+
25+
# change user
26+
USER node
27+
28+
# mark as production build
2129
ENV NODE_ENV=production
30+
31+
# run build on container startup in order to build in environment variables
32+
# - https://create-react-app.dev/docs/adding-custom-environment-variables/
33+
# TODO: find a better solution, i.e.
34+
# - https://www.tutorialworks.com/openshift-deploy-react-app/
35+
# - https://javaadpatel.com/building-and-deploying-react-containers/
2236
CMD ["sh", "-c", "npm run build && node server/dist/server.js build/ $PORT"]
37+
38+

dashboard/origin-mlx/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ http://localhost:3000/settings
5656

5757
```Bash
5858
cd dashboard/origin-mlx
59-
docker build -t <your docker user-id>/<repo name>:<tag name> -f Dockerfile .
59+
docker build -t <your docker user-id>/mlx-ui:<tag name> -f Dockerfile .
6060
docker push <your docker user-id>/<repo name>:<tag name>
6161
```
6262

0 commit comments

Comments
 (0)