2023-02-10 19:44:23 +00:00
|
|
|
# Originally from: https://github.com/devcontainers/images/blob/main/src/javascript-node/.devcontainer/Dockerfile
|
|
|
|
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
|
2024-03-13 05:23:13 +00:00
|
|
|
ARG VARIANT=18-bullseye
|
2023-02-10 19:44:23 +00:00
|
|
|
FROM node:${VARIANT}
|
|
|
|
|
|
|
|
ARG USERNAME=node
|
|
|
|
ARG NPM_GLOBAL=/usr/local/share/npm-global
|
|
|
|
|
|
|
|
# Add NPM global to PATH.
|
|
|
|
ENV PATH=${NPM_GLOBAL}/bin:${PATH}
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
# Configure global npm install location, use group to adapt to UID/GID changes
|
|
|
|
if ! cat /etc/group | grep -e "^npm:" > /dev/null 2>&1; then groupadd -r npm; fi \
|
|
|
|
&& usermod -a -G npm ${USERNAME} \
|
|
|
|
&& umask 0002 \
|
|
|
|
&& mkdir -p ${NPM_GLOBAL} \
|
|
|
|
&& touch /usr/local/etc/npmrc \
|
|
|
|
&& chown ${USERNAME}:npm ${NPM_GLOBAL} /usr/local/etc/npmrc \
|
|
|
|
&& chmod g+s ${NPM_GLOBAL} \
|
|
|
|
&& npm config -g set prefix ${NPM_GLOBAL} \
|
|
|
|
&& su ${USERNAME} -c "npm config -g set prefix ${NPM_GLOBAL}" \
|
|
|
|
# Install eslint
|
2024-01-22 08:30:35 +00:00
|
|
|
&& su ${USERNAME} -c "umask 0002 && npm install -g eslint" \
|
2023-02-10 19:44:23 +00:00
|
|
|
&& npm cache clean --force > /dev/null 2>&1
|
|
|
|
|
|
|
|
WORKDIR /
|
|
|
|
COPY entrypoint.sh .
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
|
|
CMD node --version
|
|
|
|
|
2024-03-13 05:23:13 +00:00
|
|
|
WORKDIR /app/registry-sdk
|
2024-01-22 08:30:35 +00:00
|
|
|
|
|
|
|
COPY package*.json .
|
2023-02-10 19:44:23 +00:00
|
|
|
RUN yarn install
|
2024-01-22 08:30:35 +00:00
|
|
|
COPY . .
|
2023-02-10 19:44:23 +00:00
|
|
|
|
2024-03-13 05:23:13 +00:00
|
|
|
WORKDIR /app/registry-sdk
|