diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 21e9f74c2..00e5a5e5b 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -27,14 +27,19 @@ services: webapp: container_name: bigcapital-webapp - image: ghcr.io/bigcapitalhq/webapp:latest + build: + context: ./ + dockerfile: packages/webapp/Dockerfile deploy: restart_policy: condition: unless-stopped server: container_name: bigcapital-server - image: ghcr.io/bigcapitalhq/server:latest + # image: ghcr.io/bigcapitalhq/server:latest + build: + context: ./ + dockerfile: packages/server/Dockerfile links: - mysql - mongo diff --git a/docker/mariadb/Dockerfile b/docker/mariadb/Dockerfile index f7b667668..2cce48c78 100644 --- a/docker/mariadb/Dockerfile +++ b/docker/mariadb/Dockerfile @@ -21,6 +21,7 @@ COPY ./docker-entrypoint.sh /docker-entrypoint-initdb.d/docker-initialize.sh # the mysql user inside the MySQL Docker container. RUN chown -R mysql:root /docker-entrypoint-initdb.d RUN chown -R mysql:root /scripts +# RUN chown -R mysql:root /tmp CMD ["mysqld"] EXPOSE 3306 \ No newline at end of file diff --git a/docker/mariadb/my.cnf b/docker/mariadb/my.cnf index ff1b64f79..1082ef9f2 100644 --- a/docker/mariadb/my.cnf +++ b/docker/mariadb/my.cnf @@ -1,2 +1,3 @@ [mysqld] -bind-address = 0.0.0.0 \ No newline at end of file +bind-address = 0.0.0.0 +innodb_temp_data_file_path = ../../../tmp/ibtmp1:12M:autoextend \ No newline at end of file diff --git a/docker/migration/Dockerfile b/docker/migration/Dockerfile index 162d5039c..7949721c0 100644 --- a/docker/migration/Dockerfile +++ b/docker/migration/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/bigcapitalhq/server:latest as build +FROM kochie/bigcapital-server:latest as build ARG DB_HOST= \ DB_USER= \ diff --git a/docker/migration/start.sh b/docker/migration/start.sh index 5fa9f0c28..1d5f70fc3 100644 --- a/docker/migration/start.sh +++ b/docker/migration/start.sh @@ -1,5 +1,5 @@ # Migrate the master system database. -./wait-for-it/wait-for-it.sh mysql:3306 -- node ./build/commands.js system:migrate:latest +./wait-for-it/wait-for-it.sh ${DB_HOST}:3306 -- node ./build/commands.js system:migrate:latest # Migrate all tenants. -./wait-for-it/wait-for-it.sh mysql:3306 -- node ./build/commands.js tenants:migrate:latest \ No newline at end of file +./wait-for-it/wait-for-it.sh ${DB_HOST}:3306 -- node ./build/commands.js tenants:migrate:latest \ No newline at end of file diff --git a/packages/server/Dockerfile b/packages/server/Dockerfile index af2de4263..4c867a714 100644 --- a/packages/server/Dockerfile +++ b/packages/server/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.20-alpine as build +FROM node:16-alpine as build USER root @@ -85,13 +85,23 @@ RUN chown node:node / # Copy application dependency manifests to the container image. COPY ./package*.json ./ +COPY ./pnpm-lock.yaml ./ +COPY ./pnpm-workspace.yaml ./ COPY ./packages/server/package*.json ./packages/server/ +# RUN curl -fsSL https://get.pnpm.io/install.sh | sh - +RUN npm install -g pnpm + COPY ./lerna.json ./lerna.json # Install app dependencies for production. -RUN npm install -RUN npm run bootstrap +RUN apk update +RUN apk add python3 build-base chromium + +# Set PYHTON env +ENV PYTHON=/usr/bin/python3 +RUN pnpm install +# RUN npm run bootstrap COPY --chown=node:node ./packages/server ./packages/server diff --git a/packages/server/src/config/index.ts b/packages/server/src/config/index.ts index bc6833130..34bc57127 100644 --- a/packages/server/src/config/index.ts +++ b/packages/server/src/config/index.ts @@ -120,6 +120,7 @@ module.exports = { * Redis storage configuration. */ redis: { + url: process.env.REDIS_URL, port: 6379, }, diff --git a/packages/webapp/Dockerfile b/packages/webapp/Dockerfile index 6415a6510..0b55a6ca6 100644 --- a/packages/webapp/Dockerfile +++ b/packages/webapp/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.15.0 as build +FROM node:16-alpine as build USER root @@ -7,11 +7,18 @@ WORKDIR /app # Install dependencies COPY package*.json ./ COPY lerna.json ./ +COPY pnpm-lock.yaml ./ +COPY pnpm-workspace.yaml ./ COPY ./packages/webapp/package*.json /app/packages/webapp/ -RUN npm install -RUN npm run bootstrap +RUN apk update +RUN apk add python3 build-base chromium +ENV PYTHON=/usr/bin/python3 + +RUN npm install -g pnpm +RUN pnpm install +# RUN npm run bootstrap # Build webapp package COPY ./packages/webapp /app/packages/webapp diff --git a/packages/webapp/craco.config.js b/packages/webapp/craco.config.js index 724a886c9..c86d33ebc 100644 --- a/packages/webapp/craco.config.js +++ b/packages/webapp/craco.config.js @@ -5,5 +5,10 @@ module.exports = { alias: { '@': path.resolve(__dirname, 'src'), }, + configure: { + resolve: { + fallback: { path: require.resolve('path-browserify') }, + }, + }, }, }; diff --git a/packages/webapp/nginx/sites/default.conf b/packages/webapp/nginx/sites/default.conf index 58bb77ece..2780060ab 100644 --- a/packages/webapp/nginx/sites/default.conf +++ b/packages/webapp/nginx/sites/default.conf @@ -5,4 +5,8 @@ server { root /usr/share/nginx/html; try_files $uri /index.html; } + + location /api { + proxy_pass http://localhost:3000; + } } \ No newline at end of file