How to Move Code into a #docker Container
▻https://hackernoon.com/how-to-move-code-into-a-docker-container-ab28edcc2901?source=rss----3a81
Docker provides two good options for moving your code into an image or container: bind mounts and the Dockerfile COPY instruction. In this post, I’ll explain why images should always use the COPY instruction in production, and why it may be more convenient to use bind mounts in development.Dockerfile COPY InstructionThe COPY instruction in a Dockerfile is used to copy files or directories from the host machine filesystem into an image. For example, the following Dockerfile sets up a NodeJS application for running in production mode.# DockerfileFROM node:carbonWORKDIR /appENV NODE_ENV=production# Install dependencies first to take advantage of Docker layer caching. COPY package.json yarn.lock ./RUN yarn install —frozen-lockfile —no-cache —production# Copy the application files (...)