From c0e8fdf1484ed8e0e806f08bf8665bd012943919 Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 21 Nov 2023 12:57:41 +0000 Subject: [PATCH] docker --- .dockerignore | 24 ++++++++++++++++++++++++ .vscode/launch.json | 11 +++++++++++ .vscode/tasks.json | 35 +++++++++++++++++++++++++++++++++++ Dockerfile | 11 +++++++++++ docker-compose.yml | 7 +++++++ 5 files changed, 88 insertions(+) create mode 100644 .dockerignore create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..809ba83 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,24 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/charts +**/docker-compose* +**/compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..2e71105 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "configurations": [ + { + "name": "Docker Node.js Launch", + "type": "docker", + "request": "launch", + "preLaunchTask": "docker-run: debug", + "platform": "node" + } + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..ef433b1 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,35 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "docker-build", + "label": "docker-build", + "platform": "node", + "dockerBuild": { + "dockerfile": "${workspaceFolder}/Dockerfile", + "context": "${workspaceFolder}", + "pull": true + } + }, + { + "type": "docker-run", + "label": "docker-run: release", + "dependsOn": ["docker-build"], + "platform": "node" + }, + { + "type": "docker-run", + "label": "docker-run: debug", + "dependsOn": ["docker-build"], + "dockerRun": { + "env": { + "DEBUG": "*", + "NODE_ENV": "development" + } + }, + "node": { + "enableDebugging": true + } + } + ] +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7646d27 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM fascinated/docker-images:node-pnpm-latest + +ENV NODE_ENV=production +WORKDIR /usr/src/app +COPY package*.json pnpm-lock.yaml ./ +RUN pnpm install --production --silent && mv node_modules ../ +COPY . . +EXPOSE 3000 +RUN chown -R node /usr/src/app +USER node +CMD ["node", "src/index.js"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e63e415 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +version: "3.4" + +services: + cors-anywhere: + image: fascinated/cors-anywhere:latest + ports: + - 3000:3000