From 51a6cacf5b2c336b3a29d1cf983aa0e4462104a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Jedlicska?= Date: Mon, 18 Jan 2021 21:15:06 +0100 Subject: [PATCH] add Dockerfile for server and frontend add reddis insigth container for redis management with a slightly hackish way (mounting the server forder inside the container) add working server app with only `docker-compose up` --- .dockerignore | 16 ++++++++++++++++ Dockerfile | 32 ++++++++++++++++++++++++++++++++ docker-compose.yaml | 35 +++++++++++++++++++++++++++++------ 3 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..048660091 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,16 @@ +.circleci +.nyc_output +.vscode +coverage + +**/node_modules + + +npm-debug.log +Dockerfile* +docker-compose* +.dockerignore +.git +.gitignore +README.md +LICENSE \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..94549fcb4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +# FROM node:14-alpine AS node +FROM node:14 AS node + +# -e "NODE_ENV=production" + +FROM node as builder + +WORKDIR /frontend + +COPY ./packages/frontend/package*.json ./ +RUN npm ci + +COPY ./packages/frontend ./ + +RUN npm run build + +WORKDIR /app +COPY ./packages/server/package*.json ./ + +RUN npm ci + +COPY ./packages/server ./ + +# FROM node:14-alpine as final +EXPOSE 3000 + +# COPY --from=builder /app /app +# COPY --from=builder /frontend /frontend + +# WORKDIR /app + +CMD node ./bin/www \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 04e351491..737242ff1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,12 +2,18 @@ version: "3" services: # this could be enabled once the server container is added - # server: - # build: - # . - # depends_on: - # - database - # - redis + server: + build: + . + depends_on: + - database + - redis + ports: + - "3000:3000" + environment: + DEBUG: "*" + volumes: + - ./packages/server:/app database: image: "postgres" # use latest official postgres version @@ -36,6 +42,23 @@ services: image: "redis" ports: - "6379:6379" # It is not neccesary to expose the reddis port if running the app with compose + volumes: + - redis_volume_data:/data + # - ./redis.conf:/tmp/redis.conf + # command: [ "redis-server", "/tmp/redis.conf"] + redis_insight: + image: redislabs/redisinsight:latest + container_name: redis_insight + restart: always + depends_on: + - redis + ports: + - 8001:8001 + volumes: + - redis_insight_volume_data:/db + volumes: speckle-postgres-data: # named volumes can be managed easier using docker-compose + redis_volume_data: + redis_insight_volume_data: \ No newline at end of file