1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-05 18:32:33 +01:00

fix: make API dockerfile use correct setup steps

This commit is contained in:
Hayden Young 2021-10-15 13:49:55 +00:00 committed by GitHub
parent 182de09ccc
commit aae55cfe71
5 changed files with 69 additions and 17 deletions

View File

@ -1 +0,0 @@
MONGO_URL=mongodb://db:27017/fosscord?readPreference=secondaryPreferred

View File

@ -1,2 +1,5 @@
node_modules/
db/
db/
dist/
coverage/
*.db

6
.env.example Normal file
View File

@ -0,0 +1,6 @@
PRODUCTION=false
DATABASE="postgres://fosscord:fosscord@db:5432/fosscord"
STORAGE_PROVIDER=file
STORAGE_LOCATION=/data

View File

@ -1,12 +1,28 @@
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/fosscord-server
COPY package.json .
COPY package-lock.json .
RUN npm rebuild bcrypt --build-from-source && npm install canvas --build-from-source
RUN apk add --no-cache \
make \
gcc \
g++ \
python \
cairo-dev \
jpeg-dev \
pango-dev \
giflib-dev
WORKDIR /usr/src/fosscord-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 npm install
COPY . .
COPY api/ .
RUN npm run build
EXPOSE 3001
RUN npm run build-docker
CMD ["node", "dist/start.js"]

View File

@ -1,24 +1,52 @@
---
version: "3"
services:
db:
hostname: fosscord_db
image: mongo:latest
image: postgres:latest
volumes:
- ./db:/data/db
- db_data:/var/lib/postgres
restart: unless-stopped
ports:
- 5432:5432
environment:
POSTGRES_USER: fosscord
POSTGRES_DATABASE: fosscord
POSTGRES_PASSWORD: fosscord
api:
hostname: fosscord_api
image: fosscord/api
build:
context: .
dockerfile: api/Dockerfile
depends_on:
- db
ports:
- 3001:3001
env_file: ./.docker/env
env_file: .env
gateway:
hostname: fosscord_gateway
image: fosscord/gateway
build:
context: .
dockerfile: gateway/Dockerfile
depends_on:
- db
ports:
- 3002:3002
env_file: ./.docker/env
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: {}