forked from ipfs/ipfs-companion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
28 lines (19 loc) · 899 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
FROM node:18.14.0
ARG USER_ID
ARG GROUP_ID
RUN curl -s https://ipfs.io/ipfs/QmbukYcmtyU6ZEKt6fepnvrTNa9F6VqsUPMUgNxQjEmphH > /usr/local/bin/jq && chmod +x /usr/local/bin/jq
RUN mkdir -p /home/node/app
RUN if [ ${USER_ID:-0} -ne 0 ] && [ ${GROUP_ID:-0} -ne 0 ]; then \
userdel -f node && \
if getent group node ; then groupdel node; fi && \
if getent passwd ${USER_ID} ; then userdel -f $(getent passwd ${USER_ID} | cut -d: -f1); fi && \
if getent group ${GROUP_ID} ; then groupdel $(getent group ${GROUP_ID} | cut -d: -f1); fi && \
groupadd -g ${GROUP_ID} node && \
useradd -l -u ${USER_ID} -g node node; fi
RUN chown -fhR node:node /home/node
WORKDIR /home/node/app
COPY --chown=node:node ./package.json ./package-lock.json /home/node/app/
USER node
RUN npm run ci:install
COPY --chown=node:node . /home/node/app
ENV PATH="/home/node/app/node_modules/.bin:${PATH}"