I am building a Docker image using the Node:12 base image. I am trying to switch it to use Node:12-alpine instead due to the smaller image size. I have installed bash and shadow in Alpine to be able to run chmod
commands.
I am running into an error with one of the RUN commands RUN chmod +755
. The error message: chmod: invalid mode '+755'
Note that this works using the Node:12 base image, so I think I just need to install another package in Alpine linux? Thanks!
FROM node:12.8-alpine
# Create working directory
RUN mkdir -p /home/node/app
# Set working directory
WORKDIR /home/node/app
# Install bash and shadow for permissions chmod commands
RUN apk add --no-cache bash && apk add shadow
# Add `/home/node/app/node_modules/.bin` to $PATH
ENV PATH /home/node/app/node_modules/.bin:$PATH
# Copy code
COPY --chown=node . /home/node/app
# Update umask
RUN chmod +755 /home/node/app/entrypoint.sh && \
echo 'umask 002' >> /home/node/.profile && \
echo 'umask 002' >> /home/node/.bashrc && \
npm install
ENTRYPOINT ["./entrypoint.sh"]
CMD [ "npm", "start" ]