summary refs log tree commit diff
path: root/api
diff options
context:
space:
mode:
authorDiego Magdaleno <diegomagdaleno@protonmail.com>2021-10-17 16:51:17 -0500
committerDiego Magdaleno <diegomagdaleno@protonmail.com>2021-10-17 16:51:17 -0500
commit413d9d5060a4571f08fb067f368127d75020c708 (patch)
tree58c3f963faf5c9076a3b9b354f3943b773492c30 /api
parentMerge branch 'master' of http://github.com/fosscord/fosscord-server (diff)
parentfix: make the CDN build correctly (diff)
downloadserver-413d9d5060a4571f08fb067f368127d75020c708.tar.xz
Merge branch 'docker-fix' of https://github.com/hbjydev/fosscord-server into hbjydev-docker-fix
Diffstat (limited to 'api')
-rw-r--r--api/Dockerfile35
1 files changed, 26 insertions, 9 deletions
diff --git a/api/Dockerfile b/api/Dockerfile
index 16443b15..41c9363b 100644
--- a/api/Dockerfile
+++ b/api/Dockerfile
@@ -1,12 +1,29 @@
-FROM node:lts-alpine
+FROM node:lts-alpine AS builder
+
 # 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 npm install
-COPY . .
-EXPOSE 3001
+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
+
+EXPOSE 3001
+
 CMD ["node", "dist/start.js"]