Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run mlx-ui as non-root user #339

Merged
merged 1 commit into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions dashboard/origin-mlx/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# base image
FROM node:14-slim
FROM node:16-slim

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

# install and cache app dependencies
COPY . /workspace

RUN npm install --silent --only=prod

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

# start app
# make sure non-root user can modify workspace folder
#RUN chgrp -R 0 /workspace && chmod -R g=u /workspace
RUN chown -R node /workspace

# change user
USER node

# mark as production build
ENV NODE_ENV=production

# run build on container startup in order to build in environment variables
# - https://create-react-app.dev/docs/adding-custom-environment-variables/
# TODO: find a better solution, i.e.
# - https://www.tutorialworks.com/openshift-deploy-react-app/
# - https://javaadpatel.com/building-and-deploying-react-containers/
CMD ["sh", "-c", "npm run build && node server/dist/server.js build/ $PORT"]


2 changes: 1 addition & 1 deletion dashboard/origin-mlx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ http://localhost:3000/settings

```Bash
cd dashboard/origin-mlx
docker build -t <your docker user-id>/<repo name>:<tag name> -f Dockerfile .
docker build -t <your docker user-id>/mlx-ui:<tag name> -f Dockerfile .
docker push <your docker user-id>/<repo name>:<tag name>
```

Expand Down
Loading