4
0

Dockerfile 839 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. RUN npm ci
  14. # Get all the code needed to run the app
  15. COPY . /usr/src/app
  16. # Expose the port the app runs in
  17. EXPOSE 3000
  18. # Serve the app
  19. CMD ["npm", "start"]
  20. FROM development as dev-envs
  21. RUN <<EOF
  22. apt-get update
  23. apt-get install -y --no-install-recommends git
  24. EOF
  25. RUN <<EOF
  26. useradd -s /bin/bash -m vscode
  27. groupadd docker
  28. usermod -aG docker vscode
  29. EOF
  30. # install Docker tools (cli, buildx, compose)
  31. COPY --from=gloursdocker/docker / /
  32. CMD [ "npm", "start" ]