summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.docker/env1
-rw-r--r--.dockerignore5
-rw-r--r--.env.example6
-rw-r--r--api/Dockerfile35
-rw-r--r--docker-compose.yml44
5 files changed, 19 insertions, 72 deletions
diff --git a/.docker/env b/.docker/env
new file mode 100644
index 00000000..595b7ba2
--- /dev/null
+++ b/.docker/env
@@ -0,0 +1 @@
+MONGO_URL=mongodb://db:27017/fosscord?readPreference=secondaryPreferred
diff --git a/.dockerignore b/.dockerignore
index 93d19905..61b7ef66 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,5 +1,2 @@
 node_modules/
-db/
-dist/
-coverage/
-*.db
\ No newline at end of file
+db/
\ No newline at end of file
diff --git a/.env.example b/.env.example
deleted file mode 100644
index 72449f88..00000000
--- a/.env.example
+++ /dev/null
@@ -1,6 +0,0 @@
-PRODUCTION=false
-
-DATABASE="postgres://fosscord:fosscord@db:5432/fosscord"
-
-STORAGE_PROVIDER=file
-STORAGE_LOCATION=/data
diff --git a/api/Dockerfile b/api/Dockerfile
index 41c9363b..08d15f72 100644
--- a/api/Dockerfile
+++ b/api/Dockerfile
@@ -1,29 +1,12 @@
-FROM node:lts-alpine AS builder
-
+FROM node:lts-alpine
 # needed for native packages (bcrypt, canvas)
-RUN apk add --no-cache \
-    make \
-    gcc \
-    g++ \
-    python \
-    cairo-dev \
-    jpeg-dev \
-    pango-dev \
-    giflib-dev
-
-WORKDIR /usr/src/api
-
-RUN npm rebuild bcrypt --build-from-source \
-    && npm install canvas --build-from-source
-
-COPY api/package.json api/package-lock.json ./
-COPY util ../util
-RUN cd ../util && npm install && cd ../api && npm install
-
-COPY api/ .
-
-RUN npm run build
-
+RUN apk add --no-cache make gcc g++ python cairo-dev jpeg-dev pango-dev giflib-dev
+WORKDIR /usr/src/fosscord-server
+COPY package.json .
+COPY package-lock.json .
+RUN npm rebuild bcrypt --build-from-source && npm install canvas --build-from-source
+RUN npm install
+COPY . .
 EXPOSE 3001
-
+RUN npm run build-docker
 CMD ["node", "dist/start.js"]
diff --git a/docker-compose.yml b/docker-compose.yml
index 3dca75fb..5861e12f 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,52 +1,24 @@
----
 version: "3"
-
 services:
     db:
         hostname: fosscord_db
-        image: postgres:latest
+        image: mongo:latest
         volumes:
-            - db_data:/var/lib/postgres
+            - ./db:/data/db
         restart: unless-stopped
-        ports:
-            - 5432:5432
-        environment:
-            POSTGRES_USER: fosscord
-            POSTGRES_DATABASE: fosscord
-            POSTGRES_PASSWORD: fosscord
-
     api:
-        build:
-            context: .
-            dockerfile: api/Dockerfile
+        hostname: fosscord_api
+        image: fosscord/api
         depends_on:
             - db
         ports:
             - 3001:3001
-        env_file: .env
-
+        env_file: ./.docker/env
     gateway:
-        build:
-            context: .
-            dockerfile: gateway/Dockerfile
+        hostname: fosscord_gateway
+        image: fosscord/gateway
         depends_on:
             - db
         ports:
             - 3002:3002
-        env_file: .env
-
-    cdn:
-        build:
-            context: .
-            dockerfile: cdn/Dockerfile
-        depends_on:
-            - db
-        ports:
-            - 3003:3003
-        volumes:
-            - cdn_data:/data
-        env_file: .env
-
-volumes:
-    db_data: {}
-    cdn_data: {}
+        env_file: ./.docker/env
\ No newline at end of file