Skip to content

Commit 121953f

Browse files
authored
Merge pull request #169 from DefangLabs/unify-dockerfile
unified dockerfiles
2 parents e92edc4 + 88beb5d commit 121953f

File tree

19 files changed

+115
-71
lines changed

19 files changed

+115
-71
lines changed

samples/angular-express/backend/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Use the official Node.js image
2-
FROM node:20-alpine
1+
# Use the slim version of Node.js v20 on Debian Bookworm as the base image
2+
FROM node:20-bookworm-slim
33

44
# Create and change to the app directory
55
WORKDIR /app
@@ -15,3 +15,6 @@ COPY . .
1515

1616
# Expose the port the app runs on
1717
EXPOSE 3000
18+
19+
# Define the command to run your application
20+
CMD ["npm", "start"]
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Use the official Node.js 14 LTS image as the base image
2-
FROM node:20-alpine
1+
# Use the slim version of Node.js v20 on Debian Bookworm as the base image
2+
FROM node:20-bookworm-slim
33

44
# Set the working directory
55
WORKDIR /app
66

77
# Copy package.json and package-lock.json
88
COPY package*.json ./
99

10-
# Install dependencies
10+
# Install dependencies using npm ci for a clean install
1111
RUN npm ci
1212

1313
# Copy the rest of the application source code
1414
COPY . .
1515

1616
# Define the command to run the application
17-
CMD ["node", "index.mjs"]
17+
CMD ["node", "index.mjs"]
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Use the official Node.js 14 LTS image as the base image
2-
FROM node:20-alpine
1+
# Use the slim version of Node.js on Debian Bookworm as the base image
2+
FROM node:20-bookworm-slim
33

44
# Set the working directory
55
WORKDIR /app
66

77
# Copy package.json and package-lock.json
88
COPY package*.json ./
99

10-
# Install dependencies
10+
# Install dependencies using npm ci for a clean install
1111
RUN npm ci
1212

1313
# Copy the rest of the application source code
1414
COPY . .
1515

1616
# Define the command to run the application
17-
CMD ["node", "index.mjs"]
17+
CMD ["node", "index.mjs"]

samples/bullmq-bullboard-redis/compose.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ services:
1313
- BOARD_PASSWORD
1414
- QUEUE
1515
depends_on:
16-
- redis
16+
- redisx
1717
#deploy:
1818
# resources:
1919
# reservations:
@@ -32,7 +32,7 @@ services:
3232
- REDIS=redis://redisx:6379
3333
- QUEUE
3434
depends_on:
35-
- redis
35+
- redisx
3636
#deploy:
3737
# resources:
3838
# reservations:
@@ -51,7 +51,7 @@ services:
5151
healthcheck:
5252
test: ["CMD", "wget", "-q", "--spider", "127.0.0.1:3000"]
5353
depends_on:
54-
- redis
54+
- redisx
5555
#deploy:
5656
# resources:
5757
# reservations:
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Use the official Node.js 14 LTS image as the base image
2-
FROM node:20-alpine
1+
# Use the slim version of Node.js on Debian Bookworm as the base image
2+
FROM node:20-bookworm-slim
33

44
# Set the working directory
55
WORKDIR /app
66

77
# Copy package.json and package-lock.json
88
COPY package*.json ./
99

10-
# Install dependencies
10+
# Install dependencies using npm ci for a clean install
1111
RUN npm ci
1212

1313
# Copy the rest of the application source code
1414
COPY . .
1515

1616
# Define the command to run the application
17-
CMD ["node", "index.mjs"]
17+
CMD ["node", "index.mjs"]

samples/feathersjs/src/Dockerfile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
FROM node:latest
1+
# Use the slim version of Node.js on Debian Bookworm as the base image
2+
FROM node:20-bookworm-slim
23

4+
# Set the working directory
35
WORKDIR /usr/src/app
46

5-
COPY package.json ./
7+
# Copy package.json and package-lock.json if available
8+
COPY package*.json ./
69

10+
# Install dependencies
711
RUN npm install
812

9-
COPY * ./
13+
# Copy the rest of the application source code
14+
COPY . ./
1015

16+
# Expose port 3030
1117
EXPOSE 3030
1218

13-
CMD [ "node", "index.js" ]
19+
# Define the command to run the application
20+
CMD ["node", "index.js"]

samples/nodejs-chatroom/app/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Use an official Node runtime based on Alpine as a parent image
2-
FROM node:18-alpine
1+
# Use the slim version of Node.js on Debian Bookworm as the base image
2+
FROM node:20-bookworm-slim
33

44
# Set the working directory to /app
55
WORKDIR /app
@@ -13,8 +13,8 @@ RUN npm install
1313
# Bundle app source
1414
COPY . .
1515

16-
#Make port 3000 available to the world outside this container
16+
# Make port 3000 available to the world outside this container
1717
EXPOSE 3000
1818

1919
# Run the app when the container launches
20-
CMD ["node", "main.js"]
20+
CMD ["node", "main.js"]

samples/nodejs-express/app/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Use an official Node runtime based on Alpine as a parent image
2-
FROM node:20-alpine
1+
# Use the slim version of Node.js on Debian Bookworm as the base image
2+
FROM node:20-bookworm-slim
33

44
# Set the working directory to /app
55
WORKDIR /app
@@ -17,4 +17,4 @@ COPY . .
1717
EXPOSE 3000
1818

1919
# Run the app when the container launches
20-
ENTRYPOINT [ "node", "main.js" ]
20+
ENTRYPOINT ["node", "main.js"]

samples/nodejs-form/app/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Use an official Node runtime based on Alpine as a parent image
2-
FROM node:20-alpine
1+
# Use the slim version of Node.js on Debian Bookworm as the base image
2+
FROM node:20-bookworm-slim
33

44
# Set the working directory to /app
55
WORKDIR /app
66

77
# Copy package.json and package-lock.json into the container at /app
88
COPY package*.json ./
99

10-
# Install any needed packages specified in package.json
10+
# Install any needed packages specified in package.json using npm ci for a clean install
1111
RUN npm ci
1212

1313
# Copy the current directory contents into the container at /app
@@ -17,4 +17,4 @@ COPY . .
1717
EXPOSE 3000
1818

1919
# Run the app when the container launches
20-
ENTRYPOINT [ "node", "main.js" ]
20+
ENTRYPOINT ["node", "main.js"]

samples/nodejs-http/app/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Use an official Node runtime based on Alpine as a parent image
2-
FROM node:18-alpine
1+
# Use the slim version of Node.js on Debian Bookworm as the base image
2+
FROM node:20-bookworm-slim
33

44
# Set the working directory to /app
55
WORKDIR /app
@@ -8,4 +8,4 @@ WORKDIR /app
88
COPY . .
99

1010
# Run the app when the container launches
11-
ENTRYPOINT [ "node", "main.js" ]
11+
ENTRYPOINT ["node", "main.js"]

0 commit comments

Comments
 (0)