Dockerfile 872 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # syntax=docker/dockerfile:1.4
  2. # Create image based on the official Node image from dockerhub
  3. FROM node:lts-buster AS development
  4. # Create app directory
  5. WORKDIR /usr/src/app
  6. # Copy dependency definitions
  7. COPY package.json /usr/src/app
  8. COPY package-lock.json /usr/src/app
  9. # Install dependecies
  10. #RUN npm set progress=false \
  11. # && npm config set depth 0 \
  12. # && npm i install
  13. COPY .npmrc .
  14. COPY .yarnrc.yml .
  15. RUN npm ci
  16. # Get all the code needed to run the app
  17. COPY . /usr/src/app
  18. # Expose the port the app runs in
  19. EXPOSE 3000
  20. # Serve the app
  21. CMD ["npm", "start"]
  22. FROM development as dev-envs
  23. RUN <<EOF
  24. apt-get update
  25. apt-get install -y --no-install-recommends git
  26. EOF
  27. RUN <<EOF
  28. useradd -s /bin/bash -m vscode
  29. groupadd docker
  30. usermod -aG docker vscode
  31. EOF
  32. # install Docker tools (cli, buildx, compose)
  33. COPY --from=gloursdocker/docker / /
  34. CMD [ "npm", "start" ]