-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdockerfile
36 lines (26 loc) · 1.06 KB
/
dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# It is a plain text file with no file extension.
# It contains instructions for Docker to build an image.
# Example: /api-gateway/Dockerfile should look like this:
# dockerfile
# ✅ When Can You Remove the Dockerfile?
# 🚫 You can remove /api-gateway/Dockerfile if:
# You are using a prebuilt Docker image (like node:18 or a published API image from Docker Hub).
# You don’t need custom environment setups, package installs, or additional dependencies.
# ✅ You must keep the Dockerfile if:
# You need to install dependencies (npm install) inside the container.
# You want a consistent runtime environment (same Node.js version, same dependencies).
# You don’t want to manually install dependencies before running the container.
#Example
# # Use Node.js base image
FROM node:18
# # Set working directory inside the container
WORKDIR /app
# # Copy package.json and install dependencies
COPY package.json package-lock.json ./
RUN npm install
# # Copy application files
COPY . .
# # Expose port 8000 for API
EXPOSE 3001
# # Start the API Gateway
CMD ["npm", "run", "dev"]