Differences

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

Link to this comparison view

ii:labs:s2:03:tasks:04 [2023/05/04 15:40]
radu.ciobanu
ii:labs:s2:03:tasks:04 [2024/04/01 21:39] (current)
florin.stancu created
Line 1: Line 1:
-==== 04. [30pWriting a Dockerfile ​====+==== 04. [20pBonus: file upload ​====
  
-== Subtasks ==+Bonus task: add a upload image input inside the ''​account-details''​ that uploads a file to the ''​public/​images/​profile''​ subfolder (also: create it!):
  
-  ​- go to the //**node_app**//​ folder from the {{:​ii:​labs:​s2:​03:​tasks:​lab3.zip|lab archive}}, which contains the source files for a simple NodeJS application +  * Use ''​type="​file"''​ attribute on the ''<​input>'';​ 
-  ​- write a Dockerfile that will be used to create an image by following the steps below: +  * Use ''​multipart/form-data''​ encoding type attribute on the ''<​form>'' ​(Google it!); 
-    - start **//from//** the latest version of the official NodeJS image, **//​node:​15.11.0-stretch//​** +  Inside ​the Flask route function: 
-    - **//​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) +    * Actually, [[https://flask.palletsprojects.com/en/3.0.x/patterns/fileuploads/|Read The Fine Manual]] for this! 
-    - **//run//** the command **//npm install//** to install the dependencies in the file from the previous step +  Finally, add an ''<​img>''​ tag to display ​the profile photo on the user's account page when everything is done!
-    ​- **//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/03/tasks/04.1683204016.txt.gz · Last modified: 2023/05/04 15:40 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