Skip to content

Commit

Permalink
Merge pull request #70 from ItzNotABug/tweak-docker-file
Browse files Browse the repository at this point in the history
Tweak: `Dockerfile`
  • Loading branch information
ItzNotABug authored Sep 15, 2024
2 parents d05f560 + 9cf0f11 commit 3d109fd
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
# Build stage
FROM node:18-alpine
FROM node:18-alpine AS deps

# Label
LABEL author="@ItzNotABug"
# Set working directory
WORKDIR /usr/src/app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install only production dependencies
RUN npm ci --omit-dev

# Build stage renamed for clarity, no actual build commands though
FROM node:18-alpine AS runner

# Set working directory
WORKDIR /usr/src/app

# Copy node_modules from 'deps' stage
COPY --from=deps /usr/src/app/node_modules ./node_modules

# Copy the rest of your application code
COPY . .

# Label
LABEL author="@ItzNotABug"

# Install PM2 globally
RUN npm install pm2 -g

# Install dependencies
RUN npm ci --omit-dev

# Start your app
CMD ["pm2-runtime", "start", "app.js", "--name", "ghosler-app"]
CMD ["pm2-runtime", "start", "app.js", "--name", "ghosler-app"]

0 comments on commit 3d109fd

Please sign in to comment.