we have a reactweb application running on port 3000 previously for production we want to use port 80. But when I run the application in local with sudo yarn run web and when I enter the password I can access the application in localhost:80. From Dockerfile sudo is not working in apline images.
Dockerfile:
FROM node:9-alpine as builder
# Create a directory where our app will be placed. This might not be
necessary
RUN mkdir -p /root
# Change directory so that our commands run inside this new directory
WORKDIR /root
# Get all the code needed to run the app
COPY . /root
WORKDIR /root
# Expose the port the app runs in
RUN npm install --global yarn@1.6.0
RUN chmod a+rwx /usr/local/lib/node_modules/yarn/bin/yarn*
RUN chmod a+rwx /usr/local/bin/yarn*
RUN yarn -v
RUN yarn install
RUN yarn add @material-ui/icons
EXPOSE 80
CMD yarn run web
From node:9-alpine
WORKDIR /root
COPY --from=builder /root .
RUN ls -la
EXPOSE 80
CMD yarn run web
The host container and port container should be on port 80.
Aucun commentaire:
Enregistrer un commentaire