Menu

Post image 1
Post image 2
1 / 2
0

My First Dockerfile: The Horrifying "Before" vs. The Efficient "After"

DEV Community·sohana khan·about 1 month ago
#aG6COCoQ
#install#docker#webdev#programming#node#copy
Reading 0:00
15s threshold

We all have that one commit we’re not proud of. You know, the one pushed late on a Friday night with the message: "pls work". For me, that commit contained my very first Dockerfile. I was fresh out of a tutorial, convinced I had mastered containerization. Spoiler: I had not. Looking back at that file is like looking at a mullet haircut from 1987. It was functional, but messy, insecure, and bloated. Let me show you the evolution. The cringe vs. the clean. The Before vs. the After. The "Before": The Wild West Dockerfile I was building a simple Node.js API. My logic was: Install everything, copy everything, run everything as root, and pray. dockerfile Before: The "It works on my machine" special FROM node:latest Create app directory (Good start, but wait for it...) WORKDIR /usr/src/app Copy EVERYTHING. Node modules? Yeah, copy those too. .git? Sure. COPY . .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More