Skip to main content

Featured

How to show full file path in the status bar or title bar in Sublime and Visual Studio Code

If you feel that you want to show the full file paths in your favorite editors - Sublime Text and Visual Studio Code, follow the simple steps below:

Sublime Text (on a Mac): Goto Sublime Text -> Preferences -> Settings and add the following:

{
    "show_full_path": true
}

Visual Studio Code (on a Mac): Goto Visual Studio, Code -> Preferences -> Settings and add the following:

{
    "window.title": "${activeEditorLong}"
}

As a small tweak, i added the following into my visual studio title, as it allows any custom string:

{
    "window.title": "${activeEditorLong} - work hard, play harder"
}

Now you can see the full path of the files in the top title bar.

Minimize your nodejs docker image size with these hacks

Note: If you are developing and deploying applications using node.js and docker, this is a post you must not miss.




Docker images have layered filesystems which the docker engine automatically reuses from other images if they are similar. So, in order to even save more filesize from your images, you can follow these steps:

1. Use alpine images

Docker images usually come with an alpine image as well. Alpine images are stripped down linux kernel which has nothing but a barebones OS container in it. I would be writing more about the alpine linux in a future post. But the images of alpine linux do not exceed 5 MB which is a huge life saver when you shipping images to and fro your teams and to production.

Node has a alpine version from its official repository with various versions that are tagged. You can have a look at https://hub.docker.com/r/mhart/alpine-node/

Please be aware that they are just plain node and it will not even contain npm. You can install npm within it as required and the steps are given in the readme of the repo.

2. Do an npm install within the image

This is a rookie mistake and I am sure most you wouldn't do an npm install and copy the node_modules folder into the image as well. You write your dockerfile in such a way that the npm install happens inside the image and not copied from your working directory.

3. Do not copy .git directory


This is an easy one. Do not copy the .git directory into your docker image.

4. Use --save-dev while installing development packages

This goes with the above two points and make sure that you use certain development packages only when you are developing and do not install them in your docker image.

5. Use mounted volumes for logs

Do not let the log files be written within the container. Use a mounted volume and separate them out into your host machine.

I have reduced the image by atleast 2x with these steps. Please let me know your inputs if you have got some.



Thanks for your support and appreciation.

You can also follow me at Twitter, Facebook, LinkedIn and Website.

Comments

Popular Posts

You will receive wonderful short stories written by him and inspirational articles once every month.