-
Notifications
You must be signed in to change notification settings - Fork 5
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 #9 from mikesir87/add-dockerfile
Add Dockerfile
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM node:22-bookworm-slim AS base | ||
WORKDIR /usr/local/app | ||
COPY package.json . | ||
|
||
# Build the typescript code | ||
FROM base AS dependencies | ||
RUN npm install | ||
COPY tsconfig.json . | ||
COPY src ./src | ||
RUN npm run build | ||
|
||
# Create the final production-ready image | ||
FROM base AS release | ||
RUN useradd -m appuser && chown -R appuser /usr/local/app | ||
ENV NODE_ENV=production | ||
RUN npm install --only=production | ||
COPY --from=dependencies /usr/local/app/dist ./dist | ||
USER appuser | ||
CMD ["node", "dist/index.js"] |
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