Added dockerization
This commit is contained in:
17
.dockerignore
Normal file
17
.dockerignore
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
Dockerfile
|
||||||
|
.dockerignore
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
.gitattributes
|
||||||
|
README.md
|
||||||
|
.npmrc
|
||||||
|
.prettierrc
|
||||||
|
.eslintrc.cjs
|
||||||
|
.graphqlrc
|
||||||
|
.editorconfig
|
||||||
|
.vscode
|
||||||
|
node_modules
|
||||||
|
build
|
||||||
|
package
|
||||||
|
**/.env
|
||||||
|
.env*
|
||||||
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
ARG NODE_VERSION=24.6.0
|
||||||
|
|
||||||
|
FROM node:${NODE_VERSION}-alpine AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN --mount=type=bind,source=package.json,target=package.json \
|
||||||
|
--mount=type=bind,source=package-lock.json,target=package-lock.json \
|
||||||
|
--mount=type=cache,target=/root/.npm \
|
||||||
|
npm ci
|
||||||
|
COPY . .
|
||||||
|
RUN npm prune --production
|
||||||
|
|
||||||
|
FROM node:${NODE_VERSION}-alpine
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=builder /app/node_modules node_modules/
|
||||||
|
COPY --from=builder /app/index.js .
|
||||||
|
USER node
|
||||||
|
EXPOSE 12345
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
CMD [ "node", "."]
|
||||||
@@ -7,7 +7,8 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node index.js"
|
"dev": "node index.js",
|
||||||
|
"docker-build": "docker build -t jeopardyserver ."
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ws": "^8.18.3"
|
"ws": "^8.18.3"
|
||||||
|
|||||||
Reference in New Issue
Block a user