Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ii:labs:s2:04:tasks:03 [2023/05/18 17:00]
radu.ciobanu
ii:labs:s2:04:tasks:03 [2024/04/11 13:09] (current)
radu.ciobanu [03. [30p] Writing a Dockerfile]
Line 1: Line 1:
-==== 03. [10pTesting for data persistence ​====+==== 03. [30pWriting a Dockerfile ​====
  
 == Subtasks == == Subtasks ==
  
-  - stop and delete ​the three containers started at exercise 1 +  - go to the //​**node_app**//​ folder from the {{:​ii:​labs:​s2:​04:​lab4_docker.zip|lab archive}}, which contains the source files for a simple NodeJS application 
-  - start them again using the same commands given at exercise 1 +  ​- write a Dockerfile that will be used to create an image by following the steps below: 
-  send a //**POST**// request using Postman and verify that the book you added at exercise 2 is still in the library+    ​- start **//​from//​** ​the latest version of the official NodeJS image, **//​node:​21-alpine3.18//​** 
 +    **//copy//** the file **//package.json//​** from the local host to the current directory in the new image (./); this file is intended to specify the dependencies of the NodeJS application (for example, the Express.js framework) 
 +    - **//run//** the command **//npm install//** to install the dependencies ​in the file from the previous step 
 +    - **//​copy//​** the source file **//​server.js//​** to the working directory **///​usr/​src/​app/​ //** 
 +    - **//​expose//​** port 8080 
 +    - set the **//​command//​** to run the application;​ you will run the **//​node//​** binary to execute the **///​usr/​src/​app/​server.js//​** file 
 +  - use the previously written Dockerfile to create an image called **//​mynodeimage//​** 
 +  - start a container running image **//​mynodeimage//​** on port 12345 in detached (daemon) mode 
 +  - verify that your application works correctly by going to [[http://​localhost:​12345]] (you should see a "Hello World" text)
ii/labs/s2/04/tasks/03.1684418450.txt.gz · Last modified: 2023/05/18 17:00 by radu.ciobanu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0