-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from ItzNotABug/tweak-docker-file
Tweak: `Dockerfile`
- Loading branch information
Showing
1 changed file
with
19 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |