diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..b512c09d47 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..7b112ea7e0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM node:18.18.2 + +WORKDIR /app + +COPY package.json ./ +COPY yarn.lock ./ + +COPY . . + +# Install node-gyp globally +RUN npm install -g node-gyp + +RUN yarn install + +RUN npm rebuild + +EXPOSE 2368 + +CMD ["yarn", "dev"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..e4487db1d6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,38 @@ +version: '3.8' + +services: + nodejs: + build: + context: . + dockerfile: Dockerfile + container_name: ghost-node + restart: unless-stopped + ports: + - "2368:2368" + volumes: + - .:/app + networks: + - app-network + + mysql: + image: mysql:8.0.35 + hostname: ghost-mysql-2 + container_name: ghost-mysql-2 + # We'll need to look into how we can further fine tune the memory usage/performance here + command: --innodb-buffer-pool-size=1G --innodb-log-buffer-size=500M --innodb-change-buffer-max-size=50 --innodb-flush-log-at-trx_commit=0 --innodb-flush-method=O_DIRECT + ports: + - "3306:3306" + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: ghost + restart: always + healthcheck: + test: "mysql -uroot -proot ghost -e 'select 1'" + interval: 1s + retries: 120 + networks: + - app-network + +networks: + app-network: + driver: bridge \ No newline at end of file