Fix server local build (#75)

* Fix server local build

* Build docs locally and for prod

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Charles Bochet 2023-04-25 17:47:15 +02:00 committed by GitHub
parent ae7bad65ca
commit d2c6a71c9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 4 deletions

View File

@ -4,7 +4,7 @@
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"start": "docusaurus start --host 0.0.0.0",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",

View File

@ -2,6 +2,7 @@ build: ##
@docker-compose down
docker volume rm dev_twenty_node_modules_front || true
docker volume rm dev_twenty_node_modules_server || true
docker volume rm dev_twenty_node_modules_docs || true
docker-compose build
up: ##

View File

@ -74,7 +74,7 @@ services:
- "1025:1025"
- "8025:8025"
twenty-server:
build:
build:
context: ../..
dockerfile: ./infra/dev/server/Dockerfile
ports:
@ -87,6 +87,15 @@ services:
SERVER_DATABASE_URL: ${SERVER_DATABASE_URL}
depends_on:
- postgres
twenty-docs:
build:
context: ../..
dockerfile: ./infra/dev/docs/Dockerfile
ports:
- "5000:3000"
volumes:
- ../../docs:/app/docs
- twenty_node_modules_docs:/app/docs/node_modules
postgres:
build: ./postgres
volumes:
@ -98,4 +107,5 @@ services:
volumes:
db_data:
twenty_node_modules_front:
twenty_node_modules_server:
twenty_node_modules_server:
twenty_node_modules_docs:

11
infra/dev/docs/Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM node:18.16.0-alpine as docs
WORKDIR /app/docs
COPY ../../docs/package.json .
COPY ../../docs/package-lock.json .
RUN npm install
COPY ../../docs .
CMD ["npm", "run", "start"]

View File

@ -9,8 +9,9 @@ WORKDIR /app/server
COPY ../../server/package.json .
COPY ../../server/package-lock.json .
RUN npm install
RUN npx prisma generate
COPY ../../server/src/database/schema.prisma ./src/database/schema.prisma
RUN npx prisma generate
COPY ../../server .

View File

@ -0,0 +1,13 @@
FROM node:18.16.0-alpine as docs
WORKDIR /app/docs
COPY ../../docs/package.json .
COPY ../../docs/package-lock.json .
RUN npm install
COPY ../../docs .
RUN npm install -g serve
CMD ["serve", "-s", "build"]