From 40ba962e93ea0c16f55cc9ba682ea4b3367ee6e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20P=C4=99dzich?= Date: Sat, 27 Jul 2024 17:29:14 +0200 Subject: [PATCH] Create a Dockerfile and Docker Compose stack --- Dockerfile | 18 ++++++++++++++++++ compose.yml | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 Dockerfile create mode 100644 compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fe03cb5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM node:lts-alpine AS build +WORKDIR /app +COPY package*.json ./ +RUN npm i +COPY . . +RUN npm run build + +FROM node:lts-alpine AS runtime +USER node +WORKDIR /app +ENV NODE_ENV production +ENV HOST 0.0.0.0 +ENV PORT 4321 +COPY --chown=node:node package*.json ./ +RUN npm ci --omit=dev +COPY --from=build --chown=node:node /app/dist ./dist +EXPOSE 4321 +CMD ["node", "./dist/server/entry.mjs"] diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..bd4a7be --- /dev/null +++ b/compose.yml @@ -0,0 +1,35 @@ +networks: + private: + external: false + name: sixdegs + public: + external: true + name: $PUBLIC_NETWORK + +volumes: + data: + name: sixdegs_data + driver: local + +services: + # app: + # build: + # dockerfile: ./Dockerfile + # container_name: sixdegs + # hostname: sixdegs + # networks: + # - public + # - private + # restart: unless-stopped + # env_file: .env + # depends_on: + # - db + db: + image: memgraph/memgraph:2.18.1 + container_name: sixdegs-db + hostname: sixdegs-db + networks: + - private + volumes: + - data:/var/lib/memgraph + restart: always