From: Ruben Beltran del Rio Date: Fri, 25 Aug 2023 21:02:27 +0000 (+0200) Subject: Add docker container / docker-compose X-Git-Url: https://git.r.bdr.sh/rbdr/junction/commitdiff_plain/baea04f1f4a2070832b85c6b1b61824297493cb7?ds=inline Add docker container / docker-compose --- diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2729ef0 --- /dev/null +++ b/docker-compose.yml @@ -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 index 0000000..25f5853 --- /dev/null +++ b/server/Dockerfile @@ -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" ] diff --git a/server/index.js b/server/index.js index 2508408..56a1df4 100644 --- a/server/index.js +++ b/server/index.js @@ -3,6 +3,7 @@ import { port } from './config.js'; import * as events from './events.js'; const server = new Server(port); +console.log(`Listening on port ${port}`); const sockets = {};