From f01d1bc73972fec228c72ee3bf920990bdb0fb54 Mon Sep 17 00:00:00 2001 From: Craig Osterhout <103533812+craig-osterhout@users.noreply.github.com> Date: Fri, 21 Oct 2022 14:24:10 -0700 Subject: [PATCH] [Issue 15934] Update get started dockerfile steps (#15944) * update dockerfile steps --- get-started/02_our_app.md | 45 ++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/get-started/02_our_app.md b/get-started/02_our_app.md index 79fc922e50..0508f3d6ad 100644 --- a/get-started/02_our_app.md +++ b/get-started/02_our_app.md @@ -35,12 +35,40 @@ we have created a ZIP file containing the application. ## Build the app's container image -In order to build the application, we need to use a `Dockerfile`. A -Dockerfile is simply a text-based script of instructions that is used to -create a container image. If you've created Dockerfiles before, you might -see a few flaws in the Dockerfile below. But, don't worry. We'll go over them. +In order to build the application, you'll need to use a `Dockerfile`. A +Dockerfile is simply a text-based file with no file extension. A Dockerfile contains a script of instructions that are used to create a container image. -1. In the `app` folder, the same location as the `package.json` file, create a file named `Dockerfile` with the following contents. +1. In the `app` folder, the same location as the `package.json` file, create a file named `Dockerfile`. You can use the following commands below to create a Dockerfile based on your operating system. + + +
+
+ + In the terminal, run the following commands listed below. + + ```console + $ cd /path/to/app + $ touch Dockerfile + ``` + +
+
+
+ + In the Windows Command Prompt, run the following commands listed below. + + ```console + $ cd \path\to\app + $ type nul > Dockerfile + ``` +
+
+
+ +2. Add the following contents to the Dockerfile. If you've created Dockerfiles before, you might see a few flaws in the Dockerfile below. But, don't worry. We'll go over them. ```dockerfile # syntax=docker/dockerfile:1 @@ -52,10 +80,11 @@ see a few flaws in the Dockerfile below. But, don't worry. We'll go over them. CMD ["node", "src/index.js"] EXPOSE 3000 ``` + > **Note** + > + > Select an instruction in the Dockerfile example to learn more about the instruction. - Please check that the file `Dockerfile` has no file extension like `.txt`. Some editors may append this file extension automatically and this would result in an error in the next step. - -2. Open a terminal and go to the `app` directory with the `Dockerfile`. Now build the container image using the `docker build` command. +3. Open a terminal and go to the `app` directory with the `Dockerfile`. Now build the container image using the `docker build` command. ```console $ docker build -t getting-started .