creates kubernetes friendly deployment

This commit is contained in:
Robert Koch
2023-10-12 11:07:11 +11:00
parent 1ed1c9ea1d
commit b42153bcc4
10 changed files with 46 additions and 12 deletions

View File

@@ -27,14 +27,19 @@ services:
webapp: webapp:
container_name: bigcapital-webapp container_name: bigcapital-webapp
image: ghcr.io/bigcapitalhq/webapp:latest build:
context: ./
dockerfile: packages/webapp/Dockerfile
deploy: deploy:
restart_policy: restart_policy:
condition: unless-stopped condition: unless-stopped
server: server:
container_name: bigcapital-server container_name: bigcapital-server
image: ghcr.io/bigcapitalhq/server:latest # image: ghcr.io/bigcapitalhq/server:latest
build:
context: ./
dockerfile: packages/server/Dockerfile
links: links:
- mysql - mysql
- mongo - mongo

View File

@@ -21,6 +21,7 @@ COPY ./docker-entrypoint.sh /docker-entrypoint-initdb.d/docker-initialize.sh
# the mysql user inside the MySQL Docker container. # the mysql user inside the MySQL Docker container.
RUN chown -R mysql:root /docker-entrypoint-initdb.d RUN chown -R mysql:root /docker-entrypoint-initdb.d
RUN chown -R mysql:root /scripts RUN chown -R mysql:root /scripts
# RUN chown -R mysql:root /tmp
CMD ["mysqld"] CMD ["mysqld"]
EXPOSE 3306 EXPOSE 3306

View File

@@ -1,2 +1,3 @@
[mysqld] [mysqld]
bind-address = 0.0.0.0 bind-address = 0.0.0.0
innodb_temp_data_file_path = ../../../tmp/ibtmp1:12M:autoextend

View File

@@ -1,4 +1,4 @@
FROM ghcr.io/bigcapitalhq/server:latest as build FROM kochie/bigcapital-server:latest as build
ARG DB_HOST= \ ARG DB_HOST= \
DB_USER= \ DB_USER= \

View File

@@ -1,5 +1,5 @@
# Migrate the master system database. # 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. # Migrate all tenants.
./wait-for-it/wait-for-it.sh mysql:3306 -- node ./build/commands.js tenants:migrate:latest ./wait-for-it/wait-for-it.sh ${DB_HOST}:3306 -- node ./build/commands.js tenants:migrate:latest

View File

@@ -1,4 +1,4 @@
FROM node:14.20-alpine as build FROM node:16-alpine as build
USER root USER root
@@ -85,13 +85,23 @@ RUN chown node:node /
# Copy application dependency manifests to the container image. # Copy application dependency manifests to the container image.
COPY ./package*.json ./ COPY ./package*.json ./
COPY ./pnpm-lock.yaml ./
COPY ./pnpm-workspace.yaml ./
COPY ./packages/server/package*.json ./packages/server/ 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 COPY ./lerna.json ./lerna.json
# Install app dependencies for production. # Install app dependencies for production.
RUN npm install RUN apk update
RUN npm run bootstrap 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 COPY --chown=node:node ./packages/server ./packages/server

View File

@@ -120,6 +120,7 @@ module.exports = {
* Redis storage configuration. * Redis storage configuration.
*/ */
redis: { redis: {
url: process.env.REDIS_URL,
port: 6379, port: 6379,
}, },

View File

@@ -1,4 +1,4 @@
FROM node:14.15.0 as build FROM node:16-alpine as build
USER root USER root
@@ -7,11 +7,18 @@ WORKDIR /app
# Install dependencies # Install dependencies
COPY package*.json ./ COPY package*.json ./
COPY lerna.json ./ COPY lerna.json ./
COPY pnpm-lock.yaml ./
COPY pnpm-workspace.yaml ./
COPY ./packages/webapp/package*.json /app/packages/webapp/ COPY ./packages/webapp/package*.json /app/packages/webapp/
RUN npm install RUN apk update
RUN npm run bootstrap 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 # Build webapp package
COPY ./packages/webapp /app/packages/webapp COPY ./packages/webapp /app/packages/webapp

View File

@@ -5,5 +5,10 @@ module.exports = {
alias: { alias: {
'@': path.resolve(__dirname, 'src'), '@': path.resolve(__dirname, 'src'),
}, },
configure: {
resolve: {
fallback: { path: require.resolve('path-browserify') },
},
},
}, },
}; };

View File

@@ -5,4 +5,8 @@ server {
root /usr/share/nginx/html; root /usr/share/nginx/html;
try_files $uri /index.html; try_files $uri /index.html;
} }
location /api {
proxy_pass http://localhost:3000;
}
} }