]> git.r.bdr.sh - rbdr/junction/commitdiff
Add docker container / docker-compose
authorRuben Beltran del Rio <redacted>
Fri, 25 Aug 2023 21:02:27 +0000 (23:02 +0200)
committerRuben Beltran del Rio <redacted>
Fri, 25 Aug 2023 21:02:27 +0000 (23:02 +0200)
docker-compose.yml [new file with mode: 0644]
server/Dockerfile [new file with mode: 0644]
server/index.js

diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644 (file)
index 0000000..2729ef0
--- /dev/null
@@ -0,0 +1,11 @@
+version: '3.8'
+
+services:
+  server:
+    build: server
+    ports:
+      - "8000:8000"
+    expose: [8000]
+    volumes:
+      - /app/node_modules
+      - ./server:/app
diff --git a/server/Dockerfile b/server/Dockerfile
new file mode 100644 (file)
index 0000000..25f5853
--- /dev/null
@@ -0,0 +1,14 @@
+FROM node:20-alpine AS base
+ENV PNPM_HOME="/pnpm"
+ENV PATH="$PNPM_HOME:$PATH"
+RUN corepack enable
+COPY . /app
+WORKDIR /app
+
+FROM base AS dependencies
+RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
+
+FROM base
+COPY --from=dependencies /app/node_modules /app/node_modules
+EXPOSE 8000
+CMD [ "node", "./index.js" ]
index 25084087ab6dd1923677838c15137b96a3ef0431..56a1df48e84b4411ea51b4ea49c9511bee93286a 100644 (file)
@@ -3,6 +3,7 @@ import { port } from './config.js';
 import * as events from './events.js';
 
 const server = new Server(port);
 import * as events from './events.js';
 
 const server = new Server(port);
+console.log(`Listening on port ${port}`);
 
 const sockets = {};
 
 
 const sockets = {};