Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify phrasing of Dockerfile on Part 9 #368

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion docs/tutorial/image-building-best-practices/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,19 @@ applications, those dependencies are defined in the `package.json` file. So what
install the dependencies, and _then_ copy in everything else? Then, we only recreate the yarn dependencies if there was
a change to the `package.json`. Make sense?

1. Update the Dockerfile to copy in the `package.json` first, install dependencies, and then copy everything else in.
1. To make your Docker container work properly, you need to update a file called the Dockerfile. Here's what you should do:

Specify the base image for the Docker image. In this case, we'll use the `node:18-alpine` image.

Set the working directory for the Docker container to `/app`.

Copy the package.json file and yarn.lock from your local machine into the Docker container's `/app` directory.

Install all the dependencies that your project needs using Yarn package manager within the Docker container with the `yarn install --production` command.

Copy all the other files and folders that your project uses in the working directory into the Docker container's `/app` directory.

Finally, set the command to run when the Docker container starts.

```dockerfile hl_lines="3 4 5"
FROM node:18-alpine
Expand Down